Oracle sql merge to insert and delete but not update

前端 未结 2 638
北恋
北恋 2021-01-02 02:15

Is there a way to use oracle merge to insert and delete but not update?

I have a table representing a set of values related to a single row in another table. I coul

2条回答
  •  被撕碎了的回忆
    2021-01-02 02:57

    I have found you can set the column to itself:

    MERGE ...
    WHEN MATCHED THEN 
       UPDATE SET a_value = a_value WHERE a_value not in ('ace','afk')
       DELETE WHERE a_value not in ('ace','afk')
    

    This negates the need for the dummy column.

提交回复
热议问题