在oracle中我可以指定列,这应该会触发触发器:
create or replace trigger my_trigger
before update of col1, col2, col3 on my_table for each row
begin
// the trigger code will be executed only if col1 or col2 or col3 was updated
end;
Run Code Online (Sandbox Code Playgroud)
现在我想要执行以下操作:当只更新一列时,我不希望触发器触发.这怎么可能?
我可以列出除一个列之外的所有列,这些列不应该触发触发器.对于包含许多列的表来说,这非常麻烦.
另一种方法是使用UPDATING函数,如下所示:
if not updating('COL3') then ...
Run Code Online (Sandbox Code Playgroud)
但是,如果我立刻更改了COL1 和 COL3,则该语句的计算结果为false.这不是我想要的,因为我只想更新一列(COL3)时限制执行.