0

I have a SQL statement which I am trying to execute from a console application on IBM DB2 database.

MERGE INTO Table 1 AS A 
USING Table 2 AS B 
ON A.IDTEXT = B.IDTEXT AND A.STATE = 1 
WHEN MATCHED THEN 
UPDATE SET A.STATE = 5

However, I am getting this error:

ERROR [42601] [IBM][SQLDS/VSE] SQL0104N  An unexpected token "MERGE" was found following "MERGE".  Expected tokens may include:  "MERGE".

I am not sure what is going wrong.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Prasad R
  • 1
  • 3
  • 2
    According to the "Db2 for VSE & VM SQL Reference" for V7 release 5, this product does not support the MERGE statement. You will need to recode . – mao Oct 23 '19 at 07:41
  • The tag indicates z/os but the message is VSE. Are you calling a Db2 instance from VSE that resides on z/OS ? – Hogstrom Oct 23 '19 at 13:52
  • @Hogstrom I tagged the question with "db2-zos" (possibly erroneously, but I thought it was close enough) since there isn't a VSE specific tag. Please feel free to remove the tag if you feel it's misleading. – mustaccio Oct 23 '19 at 14:41
  • No worries on the tag. I was asking as each platform has more or less functionality. So this is VSE. Ok, I’m doing some research – Hogstrom Oct 24 '19 at 00:30

0 Answers0