ITPub博客

首页 > 数据库 > Oracle > 记一次ora-04091错误

记一次ora-04091错误

原创 Oracle 作者:qqmengxue 时间:2010-09-27 10:39:17 0 删除 编辑

今天项目组报一个触发器ora-04091错误:

before insert or delete or update on aaa
for each row
declare
maxsss number;
begin
pro_test(:new.a);
end;

create or replace procedure pro_test(a number) is
mm number;
begin
dbms_output.put_line(a);
select count(*) into mm from aaa;
end;

update aaa set aaa.a=1;

ERROR at line 1:
ORA-04091: table SCOTT.AAA is mutating, trigger/function may not see it
ORA-06512: at "SCOTT.PRO_TEST", line 5
ORA-06512: at "SCOTT.TRI_AAA", line 4
ORA-04088: error during execution of trigger 'SCOTT.TRI_AAA'

经检查发现在触发器里对触发的表进行了查询操作导致的,解决的办法是:

PRAGMA AUTONOMOUS_TRANSACTION; 加独立事务处理,然后再在过程中加入commit进行一次提交问题解决!

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10130206/viewspace-1039009/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 块chain后的研究
请登录后发表评论 登录
全部评论

注册时间:2009-03-26

  • 博文量
    169
  • 访问量
    589154