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 IC81971 Status: Closed

UNPREDICTABLE RESULTS FROM FUNCTION WITH ROW RESULT TYPE AND OUTPUT
PARAMETERS

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problem description:
A function that returns a row result type and has output 
parameters can produce unpredictable results.  The assignment to 
the variables representing the output parameters and return 
value are shifted such that: 
 
output parameter 1 is assigned to the variable for the return 
value 
output parameter 2 is assigned to the variable for output 
parameter 1 
... 
output parameter N is assigned to the variable for output 
parameter N-1 
the return value is assigned to the variable for output 
parameter 1 
 
The problem occurs when assigning a function with a row result 
type to a row variable using the SET or VALUES INTO statements. 
Either the source or target (or both) must be an anchored row 
data type, and the source function must have one or more output 
parameters. 
 
An error will likely be reported as a result of these mismatched 
assignments, for example, SQL0303N.  It is also possible no 
error is reported but the function invocation produces wrong 
results.  This symptom is demonstrated in the example below. 
 
create table t1 (c1 varchar(20)) 
DB20000I  The SQL command completed successfully. 
 
create table result (type varchar(20), text varchar(20)) 
DB20000I  The SQL command completed successfully. 
 
create type row1 as row anchor row t1 
DB20000I  The SQL command completed successfully. 
 
create function foo(out a varchar(20)) returns anchor row t1 
begin 
 declare returnVal anchor row t1; 
 set a = 'output value'; 
 set returnVal.c1 = 'return value'; 
 return returnVal; 
end 
DB20000I  The SQL command completed successfully. 
 
begin 
 declare v1 anchor row t1; 
 declare v2 varchar(20); 
 set v1 = foo(v2); 
 insert into result values ('output', v2), ('result', v1.c1); 
end 
DB20000I  The SQL command completed successfully. 
 
select * from result 
 
TYPE                 TEXT 
-------------------- -------------------- 
output               return value 
result               output value 
 
  2 record(s) selected.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 LUW Version 9.7 Fix Pack 6                    * 
****************************************************************
Local Fix:
available fix packs:
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 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 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Solution
Fixed in DB2 LUW Version 9.7 Fix Pack 6
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
12.03.2012
06.06.2012
06.06.2012
Problem solved at the following versions (IBM BugInfos)
9.7.FP6
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.6 FixList