Oracle 行级触发器的一个问题,恳请各位帮忙
一个简单的触发器如下:
create or replace trigger test
after insert on tbl_test
for each row
begin
update test set status = '1' when test.id = :new.id;
end;
载编译的时候没有问题,但在运行
insert into tbl_test(id) values('1');
时总是出现 ORA-04091的错误。
ORA_4091的描述如下:
Cause: A trigger (or a user defined PL/SQL function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.
Action: Rewrite the trigger (or function) so it does not read that table.
现在的问题是,以前(大概一个月前),我们基于这个触发器的测试都是正确的。
所以,问题:
行级触发器中, after 情况下,能否进行对触发这个行级触发器的语句进行修改?
或者,在什么情况下是可以的。
希望各位能给你帮助,。
thanks advance.