create or replace trigger admin.patreg_paid_amt_temp
before UPDATE OF PAIDAMOUNT_TEMP ON admin.patient_registration
REFERENCING OLD AS OLD NEW AS NEW
For EACH ROW
BEGIN
if :new.PAIDAMOUNT_TEMP != :old.PAIDAMOUNT_TEMP
then
UPDATE admin.patient_registration d
set d.PAID_AMOUNT = :new.PAIDAMOUNT_TEMP + d.DIFFERENCE ,
d.PENDING = ABS(:new.PAIDAMOUNT_TEMP - d.DUES)
where d.PATIENT_ID = :new.PATIENT_ID;
end if;
END;
我知道这是因为触发器无法更改它读取的表的内容。
谁能帮我完成这个
当我编写此查询时,发生以下错误
update admin.patient_registration set paidamount_temp= 1000 where patient_id=11;
执行请求的操作时遇到错误
ORA-04091:表 Admin.PATIENT_REGISTRATION 正在变异,触发器/函数可能看不到它
ORA-06512:在“ADMIN.PATREG_PAID_AMT_TEMP”,第 4 行
ORA-04088:执行触发器“ADMIN.PATREG_PAID_AMT_TEMP”
时出错 04091.000000-”表 %s.%s 正在发生变化,触发器/函数可能看不到它”