hello
i use db2 express c
i want to create trigger and i want to use new reference
the code is:
CREATE TRIGGER IBM.TRIGGER_TRIG17
AFTER INSERT
ON IBM.AMD
REFERENCING
NEW AS NEW
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
declare VAR_KEY_FIELDS integer;
if (user != 'db2admin') then
set VAR_KEY_FIELDS = nextval for ibm.seq1;
insert into replication.KEY_FIELDS values (1,1,NEW.id1,1);
end if;
/* Trigger body */
END;
i get this error:
Message: [IBM][CLI Driver][DB2/NT] SQL0206N "NEW.ID1" is not valid in the context where it is used. LINE NUMBER=16. SQLSTATE=42703
SQL: CREATE TRIGGER IBM.TRIGGER_TRIG1755
what the problem is ?