i don't know how the code throws up errors. it compiles correctly but when it used it throws up an error.
create or replace TRIGGER TRG_APPLICATIONS
BEFORE INSERT or UPDATE OF APP_ID, STATUS_ID
ON APPLICATIONS
FOR EACH ROW
BEGIN
:new.APP_ID := SEQ_APP_ID.nextval;
:new.APP_DATE := SYSDATE;
IF UPDATING AND ( :NEW.STATUS_ID = 2 OR :NEW.STATUS_ID = 5 OR :NEW.STATUS_ID = 7 OR :NEW.STATUS_ID = 8 )
THEN
INSERT INTO APP_HISTORY (SRN, STATUS_ID, APP_DATE)
VALUES (:OLD.SRN, :OLD.STATUS_ID, :OLD.APP_DATE);
DELETE FROM APPLICATIONS WHERE :NEW.STATUS_ID = 2;
DELETE FROM APPLICATIONS WHERE :NEW.STATUS_ID = 5;
DELETE FROM APPLICATIONS WHERE :NEW.STATUS_ID = 7;
DELETE FROM APPLICATIONS WHERE :NEW.STATUS_ID = 8;
END IF;
END;
this is the error message
error ORA-04091: table APEX514.APPLICATIONS is mutating,
trigger/function may not see it ORA-06512: at "APEX514.TRG_APPLICATIONS",
line 14 ORA-04088: error during execution of trigger 'APEX514.TRG_APPLICATIONS'
editbutton.