运行触发器时出现变异错误

时间:2019-05-26 06:08:34

标签: sql oracle database-trigger mutating-table

当我尝试更新表时,我正在获取表突变错误

update flight 
set captainStaffID='S0009' 
where flightid='000000043';

这是触发因素:

create or replace trigger trigger1 
before INSERT OR UPDATE of captainStaffID,firstOfficerStaffID on flight
for each row


if UPDATING  then
    select count(*) into temp7 
    from flight 
    where flightid in (select ap.flightid  
                       from ADDITIONAL_PILOT ap 
                       where activityCode ='TR');
    dbms_output.put_line('New'||:new.flightid||'OLD'||:old.flightid);


end if;

end trigger1;
/

第1行出现错误:

  

ORA-04091:表XXXXXx.FLIGHT正在变异,触发器/功能可能看不到
  ORA-06512:位于“ XXXXXX.TRIGGER1”的第7行
  ORA-04088:执行触发器..... TRIGGER1'

时出错

我正在使用下面的更新查询来启动我的触发器

update flight set captainStaffID='S0009' where flightid='000000043';

0 个答案:

没有答案