Hello
I\\\'m new to DB2 and I\\\'ve been trying to create the MERGE statement using PreparedStatements in Java as a requirement for a project I\\\'m working on, but I get the following message:
DB2 SQL error: SQLCODE: -418, SQLSTATE: 42610, SQLERRMC: null
The statements I am creating are very long but here is a short example of the the statements I am using:
MERGE INTO schema.tableName USING
( VALUES ( ?, ?, ?, ?)) as lb ON (primaryKeyField = ?)
WHEN MATCHED THEN UPDATE
SET field2 = ?, field3 = ?, field4 = ?
WHEN NOT MATCHED THEN
INSERT(primaryKeyField, field2, field3, field4)
VALUES(?,?,?,?)
I\\\'ve already tested that each value is assigned to the corresponding parameter.
Do I have to use the CAST operator on every value in the SET clause? What exactly is causing the error?
Thanks in advance. Have a good day
Robert