Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

mutating, trigger/function

Sudhir_MeruJun 9 2014 — edited Jun 9 2014

Hi,

I am getting below error in trigger

Error ORA-04091: table PORTAL.PARTNER_LOCATIONS is mutating, trigger/function may not see it ORA-06512: at "PORTAL.AUDIT_PARTNER_LOCATIONS_TRG", line 7 ORA-04088: error during execution of trigger 'PORTAL.AUDIT_PARTNER_LOCATIONS_TRG'

create or replace TRIGGER AUDIT_PARTNER_LOCATIONS_TRG

AFTER INSERT OR UPDATE  ON PARTNER_LOCATIONS

FOR EACH ROW

DECLARE

L_ID NUMBER;

L_STATUS VARCHAR2(1000);

BEGIN

SELECT ID, STATUS INTO L_ID, L_STATUS FROM PARTNER_LOCATIONS WHERE ID = :NEW.ID;

  IF L_STATUS = 'DEAUTHORIZED' or L_STATUS = 'TERMINATED' THEN 

    INSERT INTO AUDIT_PARTNER_LOCATIONS_STATUS VALUES (L_ID, L_STATUS);

  END IF;

END;

Please suggest me how to fix this error

Thanks
Sudhir

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2014
Added on Jun 9 2014
4 comments
1,921 views