【发布时间】:2021-06-14 09:50:11
【问题描述】:
我在 oracle 中创建了一个触发器,只要同一个表的“数量”列有更新,我就需要更新“小计”列。所以我应该触发这个触发器的更新命令是:
更新 TABLENAME set QUANTITY = 6 where Order_ID = 601 AND ITEM_SEQ = 4 ;
这应该会触发我拥有的以下触发器:
AFTER UPDATE ON TABLENAME
FOR EACH ROW
BEGIN
IF UPDATING THEN UPDATE TABLENAME
SET SUBTOTAL = :NEW.QUANTITY * ACTUAL_PRICE
WHERE order_id = :NEW.order_id;
END IF;
END; ```
However i am getting a mutating error issue ORA-04091. I searched and found that this is generally when the table is updating and we try to insert values to it , however i used "AFTER" command and so the table should have been updated by then.
Any help ?
【问题讨论】:
标签: oracle oracle11g triggers mutating-table