Update if different/changed

后端 未结 8 2027
野性不改
野性不改 2020-12-15 02:54

Is it possible to perform an update statement in sql, but only update if the updates are different?

for example

if in the database, col1 = \"hello\"

8条回答
  •  一生所求
    2020-12-15 03:23

    CREATE OR REPLACE PROCEDURE stackoverflow([your_value] IN TYPE) AS
    BEGIN
       UPDATE   [your_table] t
         SET t.[your_collumn] = [your_value]
       WHERE t.[your_collumn] != [your_value];
      COMMIT;
    
    
    EXCEPTION
     [YOUR_EXCEPTION];
    
    END stackoverflow;
    

提交回复
热议问题