user3280677
user3280677

Reputation: 75

Getting Mutating trigger error while updating

i am trying update lastupdate column when ever there is change in colB, but when i used below trigger i am getting mutating trigger error, i tried using compound trigger as well

 create or replace trigger LASTUPDATE_TRIG
 BEFORE update on TABLE_A

 referencing OLD as old NEW as new
 for each row WHEN (new.colB <> old.COLB)
 DECLARE

V_NUMBER NUMBER;
begin

V_NUMBER := :new.COLA;
update TABLE set LAST_UPDATE_DATE = sysdate where colA= v_number;
end; 

Upvotes: 0

Views: 30

Answers (1)

user3280677
user3280677

Reputation: 75

          CREATE OR REPLACE TRIGGER LASTUPDATE_TRIG
    before INSERT OR DELETE OR UPDATE ON FQC_TABLE A
 referencing old as old new as new 
    for  each row 

    begin

        if :new.COLB <> :old.COLB and updating  then
         :new.LAST_UPDATE_DATE:=sysdate;
        end if;

end;

Upvotes: 1

Related Questions