views:

16

answers:

2

Hi everyone, i am creating a trigger and receiving some error, which i m not able to understand. Pls can anyone help me with that.

create or REPLACE TRIGGER trig_data
  BEFORE INSERT
    ON data_db REFERENCING OLD AS OLD AND NEW AS NEW
    FOR EACH ROW
    BEGIN
      SELECT RAHUL_SEQUENCE.NEXTVAL INTO :NEW.USERID FROM DUAL; 
    END;
Error report:
ORA-04079: invalid trigger specification
04079. 00000 -  "invalid trigger specification"
*Cause:    The create TRIGGER statement is invalid.
*Action:   Check the statement for correct syntax.
A: 

This part is wrong:

REFERENCING OLD AS OLD AND NEW AS NEW

There should be no "AND" there:

REFERENCING OLD AS OLD NEW AS NEW

(In fact why not just remove it altogether as it does nothing?)

Tony Andrews
A: 

I believe you can't reference OLD on an insert trigger; that might be what it is complaining about.

Brian Hooper