DB2 - Problem description
Problem IC64191 | Status: Closed |
SQL0901N IS RETURNED WHEN RUNNING MERGE STATEMENT WITH INSERT CLAUSE THAT USES A SCALAR SQL FUNCTION IN A DPF ENVIRONMENT. | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
When using MERGE statement with INSERT clause that uses scalar sql function in a DPF environment, SQL0901n error is returned. EX: create table <target_table> (tc1 int not null, tc2 int, tc3 int) partitioning key (tc1); create table <source_table> (sc1 int not null, sc2 int, sc3 int); create function double1(inparm1 int) returns int language sql deterministic no external action reads sql data begin atomic declare var1 int;-- set var1 = inparm1 * 2;-- return (var1);-- end; merge into <target_table> using (select sc1, sc2, sc3 from source_table) as src (ssc1, ssc2, ssc3) on (ssc1 = tc1) when matched then update set tc2 = ssc2 when not matched then insert values (ssc1, ssc2, double1(ssc3)); --SQL0901N The SQL statement failed because of a non-severe system error. --Subsequent SQL statements can be processed. (Reason "Not exactly one --non-subquery input qun: ambiguous nextQun".) SQLSTATE=58004 THE ISSUE CRITERIA: -- DPF -- Merge with INSERT clause -- INSERT clause references a scalar SQL function | |
Problem Summary: | |
SQL0901N IS RETURNED WHEN RUNNING MERGE STATEMENT WITH INSERT CLAUSE THAT USES A SCALAR SQL FUNCTION IN A DPF ENVIRONMENT. | |
Local Fix: | |
Modify each partitioning key column in the INSERT clause to a non-trivial expression like the following: merge into <target_table> using (select sc1, sc2, sc3 from <source_table>) as src (ssc1, ssc2, ssc3) on (ssc1 = tc1) when matched then update set tc2 = ssc2 when not matched then insert values (case when (1=1) then ssc1 end, ssc2, double1(ssc3)); | |
available fix packs: | |
DB2 Version 9.1 Fix Pack 9 for Linux, UNIX and Windows | |
Solution | |
It is Fixed in DB2 v9.7 FP2 | |
Workaround | |
not known / see Local fix | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC67748 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 29.10.2009 06.07.2010 06.07.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP2 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.1.0.9 | |
9.7.0.2 |