我编写了用于更新同一个表中的列值的触发器。对于Ex,我在更新assettype列后在metermaster表上写了一个触发器,在触发器中我试图更新同一个metermaster表中的instantaneousinterval列。它抛出这样的错误
错误:ORA-04091:表 PSEB.METERMASTER 正在变异,触发器/函数可能看不到它。
我的触发代码如下:
CREATE OR REPLACE TRIGGER PSEB.spiupdate
AFTER
update of assettype
ON pseb.metermaster
referencing new as new old as old
for each row
DECLARE
vassettype number;
resval number(10);
vassettypename varchar2(50);
vmeterid number;
begin
select :new.assettype,:new.meterid INTO vassettype,vmeterid from dual;
select assettypename into vassettypename from pseb.METERASSETINSTTYPE where ASSETTYPEID=vassettype;
select case when assettypename like 'DT' then 86400 when assettypename like 'HT' then 3600 when assettypename like 'FSB' then 86400 end into resval from pseb.meterassetinsttype where assettypename =vassettypename;
update pseb.metermaster set instantaneousinterval=resval where meterid=vmeterid;
end;
我尝试使用
pragma autonomous_transaction;
但它给出了死锁条件。错误:ORA-00060:在等待资源时检测到死锁 ORA-06512:
请帮我解决这个问题。