Is mutating trigger function may not see?

Is mutating trigger function may not see?

The Oracle mutating trigger error occurs when a trigger references the table that owns the trigger, resulting in the “ORA-04091: table name is mutating, trigger/function may not see it.” message. Don’t use triggers – The best way to avoid the mutating table error is not to use triggers.

What is the cause of mutating table error How can you solve it?

A mutating table error (ORA-04091) occurs when a row-level trigger tries to examine or change a table that is already undergoing change (via an INSERT, UPDATE, or DELETE statement). In particular, this error occurs when a row-level trigger attempts to read or write the table from which the trigger was fired.

When is trigger / function may not see it?

ORA-04091: table SYSTEM2.DETAILRENTAL is mutating, trigger/function may not see it ORA-06512: at “SYSTEM2.TRG_VIDEORENTAL_UP”, line 3 ORA-04088: error during execution of trigger ‘SYSTEM2.TRG_VIDEORENTAL_UP’ 1. UPDATE DETAILRENTAL 2. SET DETAIL_RETURNDATE = null 3. WHERE RENT_NUM = 1006 AND VID_NUM = 61367

How to trigger ora-04091 table is mutating?

I have below trigger in which for FIELD_NAME field i want to insert value into FIELD_TRACKING table as ‘Deactivation time of KPI in case of Downtime (Select KPI_FREQ_TIME_UNIT FROM KPI_DEFINITION)’. The bracket part in this string value comes from KPI_FREQ_TIME_UNIT field of KPI_DEFINITION table. So below is the trigger i have wrritten for this.

What is the purpose of trigger in SQL?

The purpose of trigger is to fire automatically when table is updated, inserted or deleted in your case. What you need is some procedure, not trigger. use this statement inside DECLARE, it will work. I had the same issue and I noticed that if you do a select on the same table you put the trigger on you may/will get this problem.

Why is my trigger firing on the same table?

But you are trying to update the same table again inside your trigger, which is compl. wrong. This this is why you are getting the error. You cannot modify the same table the trigger is firing on. The purpose of trigger is to fire automatically when table is updated, inserted or deleted in your case.