SQL0797N
Quote:
SQL0797N
The trigger trigger-name is defined with an unsupported triggered SQL statement.
Explanation
The trigger must be defined with a triggered SQL statement that can only include statements from the following lists.
A trigger can include the following control statements:
•Compound SQL (compiled) statement
•Compound SQL (inlined) statement
•FOR statement
•GET DIAGNOSTICS statement
•IF statement
•ITERATE statement
•LEAVE statement
•SIGNAL statement
•WHILE statement
...
...
A BEFORE trigger that is defined using an SQL compound (compiled) statement can also include the following triggered SQL statements:
•an INSERT statement
•a searched UPDATE statement
•a searched DELETE statement
•a MERGE statement
•a CALL statement
•a fullselect
•an assignment statement
|
See this statement.
Quote:
A BEFORE trigger...using an SQL compound (compiled) statement can also include ...
...
|
So, try with adding BEGIN, END(that makes an
SQL compound (compiled) statement), and statement-termination-character("@"), like...
CREATE TRIGGER BEFOREINSERT
BEFORE UPDATE ON DB2INST1.STATUS
REFERENCING OLD as O NEW AS N
FOR EACH ROW
when (O.TARGET <> N.TARGET )
BEGIN
Insert into DB2inst1.TEST_HISTORY
(
CREATEDDATE)
VALUES
(
CURRENT TIMESTAMP);
END@