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

INCORRECT ROWCOUNT IN SQLERRD[2] (OR FROM GET DIAGNOSTICS) WHEN A GLOBAL
VARIABLE IS INSTANTIATED

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problem description:
If an insert, update or delete statement refers to global 
variable and the reference is the first time the global variable 
is referenced in the connection, then sqlerrd[2] value in the 
SQLCA for this statement will be incorrectly incremented by 1 
giving an inflated row count.   Similarly if the statement is in 
an SQL procedure, GET DIAGNOSTICS will return an inflated 
rowcount. 
 
So, for example: 
 
CREATE TABLE T1 (i int) 
insert into T1 values 1,2,3 
CREATE VARIABLE var1 INT default 0 
 
 
In a new connection: 
 
update t1 set i=i+1 where i > var1 
 
The sqlerrd[2] value from the sqlca from this operation will 
show a value of 4 instead of 3 
 
If the statement is referenced again, then the count will be 
correct.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* use of global variables                                      * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* incorrect rowcount from sqlca, GET DIAGNOSTIC                * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Move to DB2 for LUW version 9.7, fixpack 3                   * 
****************************************************************
Local Fix:
If the row count value is relevant, reference global variable in 
a separate statement before referencing it in an 
update/delete/insert statement.
available fix packs:
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.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
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 9a 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
Fixed in DB2 for LUW version 9.7, fixpack 3
Workaround
not known / see Local fix
BUG-Tracking
forerunner  : APAR is sysrouted TO one or more of the following: IC69720 
follow-up : 
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
06.07.2010
20.09.2010
20.09.2010
Problem solved at the following versions (IBM BugInfos)
9.7.FP3
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.3 FixList
9.7.0.3 FixList