Fixes are available
Db2 Version 11.1 Mod2 Fix Pack2 iFix002 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod 3 Fix Pack 3 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod3 Fix Pack3 iFix001 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod3 Fix Pack3 iFix002 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod4 Fix Pack4 iFix001 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod 4 Fix Pack 4 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod 4 Fix Pack 6 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod 4 Fix Pack 5 for Linux, UNIX, and Windows
Db2 Version 11.1 Mod 4 Fix Pack 7 for Linux, UNIX, and Windows
APAR status
Closed as program error.
Error description
DB2 may return wrong results when all the following conditions are met: -The database has oracle compatibility (DB2_COMPATIBILITY_VECTOR=ORA) mode enabled. -The SELECT query being issued contains a relational operator predicate with SUBSTR. -The string argument to SUBSTR is from a table that has an index on that column. -The other operand of the relational operator is a literal. This forces the optimizer to perform an index scan using only the start/stop predicates. The index scan LOLEPOP does not contain the SUBSTR predicate, only the start/stop preds. Example: create table t (v VARCHAR(128)); create index i on t(v); insert into t values 'PT1', 'PT10'; select v from t where substr(v, 1, 20) = cast('PT1' as VARCHAR(20)); The above query returns two rows ('PT1', 'PT10') when we should only be returning one ('PT1'). The expected result (one row) is returned by the following: select v from t where v = cast('PT1' as VARCHAR(20));
Local fix
Workaround: Replace the literal with a table column or variable. Continuing with the example above: create variable myvar char(3) default 'PT1'; select * from test where substr(v, 1, 20) = myvar;
Problem summary
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to Db2 11.1 Mod 2 Fix Pack 2 iFix002 or higher * ****************************************************************
Problem conclusion
First fixed in Db2 11.1 Mod 2 Fix Pack 2 iFix002
Temporary fix
Comments
APAR Information
APAR number
IT21948
Reported component name
DB2 FOR LUW
Reported component ID
DB2FORLUW
Reported release
B10
Status
CLOSED PER
PE
NoPE
HIPER
YesHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2017-08-09
Closed date
2017-12-22
Last modified date
2017-12-22
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
DB2 FOR LUW
Fixed component ID
DB2FORLUW
Applicable component levels
Document Information
Modified date:
04 May 2022