Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ignore insert errors within a merge statement?

Ward Flores-OracleMay 6 2009 — edited May 6 2009
Hello all,

I wonder if it is possible somehow to ignore failures regarding the insert statement within a bulk merge statement? The error encountered is the violation of a primary key. What happens is that different transactions share the same plsql procedure. Therefore, it could happen that different transactions will try to insert two rows with the same primary key.

MERGE INTO table
USING collection
ON (table.id = collection.id)
WHEN MATCHED THEN
UPDATE ..
WHEN NOT MATCHED THEN
INSERT ... -> it can fail for duplicates here

Would the only workaround be to use "bulk update + bulk insert (ignore errors)" instead of a bulk merge?

Any help is very much appreciated,
wf
This post has been answered by Centinul on May 6 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2009
Added on May 6 2009
8 comments
2,977 views