Skip to Main Content

Oracle Database Discussions

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!

Debugging Merge Statement in Oracle

User_19BPUOct 5 2015 — edited Oct 5 2015

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.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 2 2015
Added on Oct 5 2015
9 comments
947 views