Hi all,
I need your help guys, i am facing an issue with the merge statement find the sample program here,
i have table TEST1 with C1 and C2 are columns and on C1 we have a primary key.
create table test1 (c1 number(5), c2 number(5));
alter table test1 add primary key (c1);
MERGE INTO test2 target
USING (SELECT 1 c1, 2 c2
FROM dual
UNION ALL
SELECT 2, 2
FROM dual
UNION ALL
SELECT 2, 2
FROM dual
UNION ALL
SELECT 2, 1
FROM dual) SOURCE
ON (target.c1 = source.c1)
WHEN MATCHED THEN
UPDATE SET c2 = source.c2
WHEN NOT MATCHED THEN
INSERT (c1, c2) VALUES (source.c1, source.c2);
when we are executing the merge statement i am facing violation of unique constraint.
Can any one help to resolve the issue?
Thank you all..