Basically, DB2 does not know what data types you send by these parameters. I assume that you are either on an older version of DB2 (less than 9.7 on Linux / Unix / Windows, or on a mainframe version older than 10.1), which does not do much βautomaticβ type conversion. Or you are sending NULL values ββ(which should still be "printed", oddly enough).
You can fix this problem by creating parameter markers as typed parameters (here I am assuming data types, use what is appropriate):
MERGE INTO AB.TESTING_TABLE A USING (VALUES ( CAST(@TEST AS CHAR(4)) ,CAST(@ACTION AS CHAR(1)) )) B(TEST_ID, "ACTION") ON (A.TEST_ID = B.TEST_ID) WHEN NOT MATCHED THEN INSERT (TEST_ID, "ACTION") VALUES (B.TEST_ID, B.ACTION) WHEN MATCHED THEN UPDATE SET "ACTION" = B.ACTION
In addition, since you are using MERGE , you do not need to use the parameters in the UPDATE or INSERT parts, you can refer to the values ββin the USING table to which you passed. In addition, since you agree to TEST_ID , you do not need to include this in your UPDATE , as it will not be updated. Anyway.
source share