Error: ORA-04084: cannot change NEW values for
this trigger type
Cause: New trigger variables can only be
changed in before row insert or update triggers.
Action: Change the trigger type or remove the
variable reference.
Example:
create table a(id
number,ROWCHANGEDATE date);
CREATE OR REPLACE TRIGGER a_UPDATE
AFTER UPDATE ON a
REFERENCING NEW AS NEW OLD AS
OLD
FOR EACH ROW
BEGIN
:NEW.ROWCHANGEDATE:=sysdate;
END;
/
ERROR
at line 1:
ORA-04084:
cannot change NEW values for this trigger type
Change
the trigger type from after to before:
CREATE OR REPLACE TRIGGER a_UPDATE
BEFORE UPDATE ON a
REFERENCING NEW AS NEW OLD AS
OLD
FOR EACH ROW
BEGIN
:NEW.ROWCHANGEDATE:=sysdate;
END;
/
Trigger
created. |