I have tried the following with a couple of variations but I continue to get errors. Any way to get this fixed. DB2 10.1 (DB2 for z/OS V10)
For the following
------------------------------
Error: An unexpected token "SRC" was found following "". Expected tokens may include: "(". SQLSTATE=42601
SQLState: 42601 ErrorCode: -104
--------------------------
However for the following
Error: The use of the reserved word "SELECT" following "" is not valid. Expected tokens may include: "VALUES". SQLSTATE=42601
SQLState: 42601 ErrorCode: -199
For the following
------------------------------
Code:
MERGE INTO TRGT t USING SRC s ON (t.ACCTID=s.ACCTID AND s.SEQID=123) WHEN MATCHED THEN UPDATE SET MyFlag = 'Y'
SQLState: 42601 ErrorCode: -104
--------------------------
However for the following
Code:
MERGE INTO TRGT t USING (SELECT SEQID, ACCTID FROM SRC WHERE SEQID=123) s ON (t.ACCTID=s.ACCTID) WHEN MATCHED THEN UPDATE SET MyFlag = 'Y'
SQLState: 42601 ErrorCode: -199