CREATE or replace TRIGGER t_table1_delete
after delete
ON   table1
FOR each row
declare m_a1 char(32);/**/    
begin 
  select max(a1) into m_a1 from table1 where gcbm=:old.gcbm;
  if (m_a1 is not null) and (m_a1<>'') then
  begin
  update table2
  set b1='good',   
b2='是'  
  where gcbm=:old.gcbm;
  end;
  else
    begin
    update table2
    set b1='ok',   
b2='否'
    where gcbm=:old.gcbm ;
  end;
  end if;
end;创建没有错误,当删除table1一行的数据时,出现错误:
ORA-04091 .............................

解决方案 »

  1.   

    ORA-04091 table string.string is mutating, trigger/function may not see it  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.  
      

  2.   

    意思就是说在 delete  触发器中不能用MAX() 函数????????????????
      

  3.   

    我用的是 oracle817  。