When doing a MERGE in Oracle SQL, how can I update rows that aren't matched in the SOURCE?

前端 未结 4 1550
心在旅途
心在旅途 2021-02-05 12:59

I have a main database and a report database, and I need to sync a table from main into report.

However, when an item

4条回答
  •  耶瑟儿~
    2021-02-05 13:56

    merge into x as target using y as Source on target.ID = Source.ID
    when not matched by target then insert
    when matched then update
    when not matched by source and target.ID is not null then
    update whatevercolumn = 'isdeleted' ;
    

提交回复
热议问题