DB2 - Problem description
Problem IT02178 | Status: Closed |
MERGE STATEMENT WITH PARAMETER MARKER AS SOURCE RETURNS SQL0901N UNDER CERTAIN CONDITIONS | |
product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
Problem description: | |
A MERGE statement may return SQL901N: SQL0901N The SQL statement or command failed because of a database system error. (Reason "invalid qnc assigment".) SQLSTATE=58004 when the following conditions are satisfied: (1) a merge source column, C, in the table-reference is derived from a parameter marker (2) the merge statement has an INSERT operation (3) the VALUES clause of the INSERT operation references a function for which C is a function argument The error stack looks like the following: ************* TRACE ERROR STACK (Recent Errors First) ************ ---------------------------------------------------------------- -------------- sqlnn_cmpl [340]:rc(-2144272270) Global semantics processing sqlns_qgs [105]:rc(-2144272270) call sqlns_handle_merge_stmt sqlns_handle_merge_stmt [100]:rc(-2144272270) Call sqlns_expand_merge sqlnq_expand_merge [1040]:rc(-2144272270) map expressions to other qun sqlnq_pt_qun_upd_all_exps [110]:rc(-2144272270) call cond_proc sqlnq_pid::qun_update [ 21]:rc(-2144272270) replace qnc called sqlnq_pid::replace_qnc [100]:rc(-2144272347) invalid qnc assigment ---------------------------------------------------------------- -------------- DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0901N The SQL statement or command failed because of a database system error. (Reason "invalid qnc assigment".) SQLSTATE=58004 Example: CREATE TABLE T1 (C1 VARCHAR(20), C2 VARCHAR(20)) ORGANIZE BY ROW; MERGE INTO T1 AS TARGET USING ( VALUES ( 'abc',? ) ) AS SOURCE (C1, C2) ON (SOURCE.C1 = TARGET.C1) WHEN NOT MATCHED THEN INSERT (C1,C2) VALUES ( SOURCE.C1, LCASE (SOURCE.C2)); | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Update to 10.5.0.5 * **************************************************************** | |
Local Fix: | |
If possible, move the function from the VALUES clause of the merge INSERT operation into the merge source (table-reference). For example, modify the MERGE statement in the example above to the following: MERGE INTO T1 AS TARGET USING ( VALUES ( 'abc',LCASE(?) ) ) AS SOURCE (C1, C2) ON (SOURCE.C1 = TARGET.C1) WHEN NOT MATCHED THEN INSERT (C1,C2) VALUES ( SOURCE.C1, SOURCE.C2); | |
Solution | |
Problem Fixed In 10.5.0.5 | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 03.06.2014 27.03.2015 27.03.2015 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) | |
10.5.0.5 |