Oracle数据库如何解决ORA-04091触发器/函数不能读它的问题?

如题所述

解决ORA-04091触发器/函数不能读它,需用oracle的自治事务。
举例如下:
create or replace trigger TR_U_ID_SYNCH
before update on COMPANY referencing old as old_value
new as new_value
for each row
declare
tId company.id%type;
PRAGMA AUTONOMOUS_TRANSACTION;
begin
if :new_value.U_ID is not null and :new_value.U_ID!=ld_value.U_ID then
select t.t_id into tId from company t where t.id= :new_value.U_ID;
:new_value.P_ID :=:new_value.U_ID;
:new_value.T_ID :=tId;
end if;
COMMIT;
end TR_CO_GB_ID_SYNCH;
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答