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!

skip the duplicate insertion and proceed

913578Dec 16 2018 — edited Dec 17 2018

I have a merge statement in a stored procedure doing insertion in Termination table.

During the process i am getting unique key contraint violation and the control is coming out. Unique constraint is there on Termination_name column.

I want the process to be continued inserting other records skipping the duplicate records which it is trying to insert.

MERGE INTO TERMINATIONS TGT

     USING (SELECT *

              FROM TMP_STG_TRFM_TERMINATIONS) SRC

        ON (TGT.TERMINATION_ID = SRC.TERMINATION_ID)

WHEN NOT MATCHED

THEN

   INSERT     VALUES (SRC.TERMINATION_ID,

                      SRC.UPDATE_DATE,

                      SRC.TERMINATION_NAME,

                      SRC.TERMINATION_TYPE_ID,

                      SRC.EQUIPMENT_ID,

                      SRC.INVENTORY_ID)

Comments
Post Details
Added on Dec 16 2018
8 comments
4,183 views