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

前端 未结 4 1507
心在旅途
心在旅途 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:37

    You can do it with a separate UPDATE statement

    UPDATE report.TEST target
    SET    is Deleted = 'Y'
    WHERE  NOT EXISTS (SELECT 1
                       FROM   main.TEST source
                       WHERE  source.ID = target.ID);
    

    I don't know of any way to integrate this into your MERGE statement.

提交回复
热议问题