Hey guys quick question:
Ive got the following trigger and error message Im having problems with
CREATE TRIGGER DB2INST1."AI_DOPORDM0" AFTER INSERT ON
DB2INST1.HMILDVL1_MCCSDTA_DOPORDM0
REFERENCING NEW_TABLE AS NTAB
FOR EACH STATEMENT MODE DB2SQL
MERGE INTO DB2INST1."HMILDVL1_MCCSDTA_DOPORDM0_TEMP" USING NTAB
ON DB2INST1."HMILDVL1_MCCSDTA_DOPORDM0_TEMP".REF_ID = NTAB.REF_ID
WHEN NOT MATCHED THEN INSERT (NTAB.REF_ID)
WHEN MATCHED THEN UPDATE DB2INST1."HMILDVL1_MCCSDTA_DOPORDM0_TEMP" SET
REF_ID = NTAB.REF_ID
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "WHEN" was found following "NSERT
(NTAB.REF_ID)
". Expected tokens may include: "<merge_value_spec>". LINE NUMBER=6.
SQLSTATE=42601
Im not sure what Im doing wrong, as I thought I followed the post of
syntax from here http://www.thescripts.com/forum/thread184082.html
Someone please help (and im on V8 FP 11)