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!

Ignoring duplicates in multi-rows INSERT

509382May 2 2006 — edited May 3 2006
Hi,

I am migrating a C++ client using MySQL C API in Oracle using OTL/OCI9i.
My problem is the following:

In MySQL is possible to run an SQL statement to insert records to specifically ask to ignore duplicates on unique keys (e.g. PRIMARY KEY).

MySQL Example:

CREATE TABLE test_tab (i1 int, i2 int, i3 int, PRIMARY KEY(i1,i2));

INSERT IGNORE INTO test_tab VALUES (1,1,1), (2,2,2), (3,3,3), (1,1,1);

The effect in MySQL is that only the first 3 records are inserted and the fourth is skipped and no errors reported by the Server to the client application.

I would like to know if there is a similar way to do this in Oracle in order to avoid to get in my client application the Oracle error: "ORA-00001: Unique constraint ... violated" stopping my application.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 31 2006
Added on May 2 2006
17 comments
5,825 views