I am trying to create a trigger that audits two fields when they are updated in a table. I have tried compiling the PL/SQL, but the following error keeps coming up.
ORA-04079: invalid trigger specification
Referring to other SO questions they mention using Declare or As to solve this problem
CREATE OR REPLACE TRIGGER AUDIT_TRIGGER
BEFORE UPDATE OF MR_STATE, IS_EXEMPT
ON CX_MR mr
FOR EACH ROW
BEGIN
IF UPDATING ('MR_STATE') THEN
INSERT INTO CX_AUDIT
(
INT_ID,
FIELD_NAME,
OLD_VAL,
NEW_VAL,
CHANGED_DATE,
CHANGED_BY
)
VALUES
(
mr.INTEGRATION_ID,
'MR_STATE',
:old.MR_STATE,
:new.MR_STATE,
SYSDATE,
'Trigger'
);
END IF;
IF UPDATING ('IS_EXEMPT') THEN
INSERT INTO CX_AUDIT
(
INT_ID,
FIELD_NAME,
OLD_VAL,
NEW_VAL,
CHANGED_DATE,
CHANGED_BY
)
VALUES
(
mr.INT_ID,
'IS_EXEMPT',
:old.IS_EXEMPT,
:new.IS_EXEMPT,
SYSDATE,
'Multiroom'
);
END IF;
END;
However I am not sure what I should be declaring or if this is the solution.