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

Query may get wrong result in VARCHAR2 enabled database when using
multi-row, multi-column VALUES clause in an IN predicate

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problem description:
In a VARCHAR2 enabled database, a multiple row, multiple column 
VALUES clause may return CHAR instead of the expected VARCHAR. 
For example: 
 
  describe VALUES ('abc', 1),('longer', 2) 
 
   Column Information 
 
   Number of columns: 2 
 
   SQL type              Type length  Column name 
Name length 
   --------------------  ----------- 
------------------------------  ----------- 
   448   CHAR                         6  1 
1 
   496   INTEGER                   4  2 
1 
 
The result type of the first column should be VARCHAR(6) since 
the two CHAR literals 'abc' and 'longer' have different lengths. 
 
When a multiple row VALUES clause is used in an IN predicate, 
wrong results may be returned, e.g.: 
 
create table T ( c1 varchar(10), c2 int ) 
insert into T values ('abc', 1) 
 
select * from T where (c1,c2) IN ( VALUES ('abc',1),('longer',2) 
) 
 
C1         C2 
---------- ----------- 
  0 record(s) selected.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 version 9.7 fix pack 11                       * 
****************************************************************
Local Fix:
Use UNION ALL instead of a multiple row VALUES clase, e.g.: 
 
  select 'abc', 1 from dual union all select 'longer', 2 from 
dual
Solution
First fixed in DB2 version 9.7 fix pack 11
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
04.12.2014
12.10.2015
12.10.2015
Problem solved at the following versions (IBM BugInfos)
9.7.FP11
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.11 FixList