home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

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
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3a for Linux, UNIX, and Windows
DB2 Version 9.1 Fix Pack 10  for Linux, UNIX and Windows
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
DB2 Version 9.1 Fix Pack 11  for Linux, UNIX and Windows
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.1 Fix Pack 12  for Linux, UNIX and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 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 FixList
9.7.0.2 FixList