相关疑难解决方法(0)

Oracle:排除一列的更新以触发触发器

在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)时限制执行.

sql oracle triggers plsql

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

oracle ×1

plsql ×1

sql ×1

triggers ×1