update using DB2 MERGE statement involving 2 tables errors out version 10

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • billoo97
    New Member
    • Nov 2013
    • 1

    update using DB2 MERGE statement involving 2 tables errors out version 10

    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
    ------------------------------
    Code:
    MERGE INTO TRGT t
    USING SRC s
    ON (t.ACCTID=s.ACCTID AND s.SEQID=123)
    WHEN MATCHED THEN
    UPDATE SET
    MyFlag = 'Y'
    Error: An unexpected token "SRC" was found following "". Expected tokens may include: "(". SQLSTATE=42601

    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'
    Error: The use of the reserved word "SELECT" following "" is not valid. Expected tokens may include: "VALUES". SQLSTATE=42601

    SQLState: 42601 ErrorCode: -199
    Last edited by Rabbit; Nov 1 '13, 08:44 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
Working...