mutating-table

Oracle triggers - problem with mutating tables

这一生的挚爱 提交于 2019-11-27 04:46:35
问题 My tables: TableA (id number, state number) TableB (id number, tableAId number, state number) TableC (id number, tableBId number, state number) So items in TableC are TableB's children and items in TableB are TableA's children. Vice versa - items in TableA are TableB's parents and items in TableB are TableC's parents. I'd like to control state of parent items... let's say for example, that we have this data: TableA (id, state): 1, 40 TableB (id, tableAId, state): 1, 1, 40 2, 1, 60 TableC (id,

ORACLE After update trigger: solving ORA-04091 mutating table error

自古美人都是妖i 提交于 2019-11-26 11:38:58
问题 I am trying to create a trigger: create or replace trigger NAME_OF_TRIGGER after insert or update on table1 REFERENCING OLD AS OLD NEW AS NEW for each row to fill in automatically a couple of non obligatory fields when updating/inserting on a table. This requires me to use a cursor that selects from table2 and also table1 (the subject of the trigger). Is there any way to avoid the mutating table error without using a temporary table for values or an autonomous transaction? 回答1: "Is there any