Hi,
I have below merge statement which is not merging any records and I am getting 0 rows merged? Not sure why it seems that the issue is with the "ON" condition of the MERGE statement (highlighted in BOLD). Please let me know how we can debug merge statement in Oracle? so that I can find out whether it is going to matched or not matched condition? Please clarify.
merge into test1_contact@contact_link o
using (
select cu.customer_name, ad.address, cu.contact_list, co.contact_id
from test_customer cu
join test_customer_address ad on ad.id = cu.id
left join test_contact co on co.contact_list = cu.contact_list
where (ad.ismodified='Y' or cu.isnew='Y')
) n
on (o.contact_id = n.contact_id)
when matched then update set contact_list = n.contact_list
when not matched then insert
(CONTACT_ID,CONTACT_NAME, CONTACT_VERSION)
values(1002,'BOB', 100);
Thanks.