ora-04091

Oracle After Delete Trigger… How to avoid Mutating Table (ORA-04091)?

寵の児 提交于 2019-11-28 01:21:38
Let's say we have the following table structures: documents docmentStatusHistory status +---------+ +--------------------+ +----------+ | docId | | docStatusHistoryId | | statusId | +---------+ +--------------------+ +----------+ | ... | | docId | | ... | +---------+ | statusId | +----------+ | ... | +--------------------+ It may be obvious, but it's worth mentioning, that the current status of a document is the last Status History entered. The system was slowly but surely degrading in performance and I suggested changing the above structure to: documents docmentStatusHistory status +---------

Oracle triggers - problem with mutating tables

99封情书 提交于 2019-11-28 01:12:27
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, tableBId, state): 1, 1, 40 2, 1, 50 3, 2, 60 4, 2, 70 Parent state should always hvae the smallest

ORA-04091: table [blah] is mutating, trigger/function may not see it

倾然丶 夕夏残阳落幕 提交于 2019-11-27 09:31:19
I recently started working on a large complex application, and I've just been assigned a bug due to this error: ORA-04091: table SCMA.TBL1 is mutating, trigger/function may not see it ORA-06512: at "SCMA.TRG_T1_TBL1_COL1", line 4 ORA-04088: error during execution of trigger 'SCMA.TRG_T1_TBL1_COL1' The trigger in question looks like create or replace TRIGGER TRG_T1_TBL1_COL1 BEFORE INSERT OR UPDATE OF t1_appnt_evnt_id ON TBL1 FOR EACH ROW WHEN (NEW.t1_prnt_t1_pk is not null) DECLARE v_reassign_count number(20); BEGIN select count(t1_pk) INTO v_reassign_count from TBL1 where t1_appnt_evnt_id=

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 Delete Trigger… How to avoid Mutating Table (ORA-04091)?

北慕城南 提交于 2019-11-26 21:53:28
问题 Let's say we have the following table structures: documents docmentStatusHistory status +---------+ +--------------------+ +----------+ | docId | | docStatusHistoryId | | statusId | +---------+ +--------------------+ +----------+ | ... | | docId | | ... | +---------+ | statusId | +----------+ | ... | +--------------------+ It may be obvious, but it's worth mentioning, that the current status of a document is the last Status History entered. The system was slowly but surely degrading in

ORA-04091: table [blah] is mutating, trigger/function may not see it

。_饼干妹妹 提交于 2019-11-26 14:46:58
问题 I recently started working on a large complex application, and I've just been assigned a bug due to this error: ORA-04091: table SCMA.TBL1 is mutating, trigger/function may not see it ORA-06512: at "SCMA.TRG_T1_TBL1_COL1", line 4 ORA-04088: error during execution of trigger 'SCMA.TRG_T1_TBL1_COL1' The trigger in question looks like create or replace TRIGGER TRG_T1_TBL1_COL1 BEFORE INSERT OR UPDATE OF t1_appnt_evnt_id ON TBL1 FOR EACH ROW WHEN (NEW.t1_prnt_t1_pk is not null) DECLARE v_reassign