Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7764729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:59:21+00:00 2026-06-01T14:59:21+00:00

In short (tl;dr): When trying to delete rows during a MERGE , Oracle 10g

  • 0

In short (tl;dr): When trying to delete rows during a MERGE, Oracle 10g seems to ignore ON DELETE CASCADE statements for foreign keys. I would like to know if this is a known bug, a feature (apparently discontinued in 11g), or what.

More in detail:
It seems to me that in Oracle XE 10g, trying to delete rows from a table within a MERGE statement leads to an ORA-02292 error (violation of referential integrity) whenever there is a foreign key referencing the destination table of the merge, even if ON DELETE CASCADE was specified in the foreign key constraint.
For example, say I create three tables

CREATE TABLE Mysource(
  MykeyS NUMBER,
  MystringS VARCHAR2(10),
  CONSTRAINT Mysource_PK PRIMARY KEY(MykeyS) ENABLE
);

CREATE TABLE Mydest(
  MykeyD NUMBER,
  MystringD VARCHAR2(10),
  CONSTRAINT Mydest_PK PRIMARY KEY(MykeyD) ENABLE
);

CREATE TABLE Myother(
  Mykey NUMBER,
  Mydate DATE,
  CONSTRAINT Myother_FK FOREIGN KEY(Mykey)
  REFERENCES Mydest(MykeyD) ON DELETE CASCADE ENABLE
);

and insert some data in them, then try

MERGE INTO Mydest D
USING Mysource S
ON (D.MykeyD=S.MykeyS)
WHEN MATCHED THEN
UPDATE SET D.MystringD = S.MystringS
DELETE WHERE (S.MykeyS > 10)
WHEN NOT MATCHED THEN
INSERT (MykeyD, MystringD)
VALUES (S.MykeyS, S.MystringS)
WHERE (S.MykeyS <= 10)

If both Mydest and Myother had some rows with >10 key, the attempted MERGE would then result in an ORA-02292, claiming a violation of the Myother_FK constraint.
This sounds illogical to me (I can delete rows from Mydest using a direct DELETE, but not with a MERGE?), and in fact it does not seem to happen with Oracle XE 11g.

Question:
Do you know if this is a known bug, or a weird feature? Or am I missing something, maybe? Searching the internet has not helped much, so far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:59:22+00:00Added an answer on June 1, 2026 at 2:59 pm

    Oracle has it listed as bug 8268746 in 10.2.0.3. It is fixed in 11.2. The document is not available for linking externally, but it provides a test case similar to the example provided in the question above. The work-around is to not use the merge statement (or upgrade to 11.2).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a short Wordpress JQuery for Wordpress comments that would allow
In short: Trying to write a wcf service for a winform-app that invokes a
In short: I'm trying to figure out if I should tell a mail administrator
Getting a 'marshal data too short' error when trying to install the mysql gem
Short version: I'm trying to determine the best way to track what the user
Short question: I'm trying to make that in a given page (uses tabs) back
Im trying to add some short file names to a Wise installer to fix
2 short questions based on trying to make my code more efficient (I think
I'm trying to write a short function that will let me quickly read in
I'm trying to delete all entrys from my abstractTableModel. As long as I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.