DB2 - Problem description
Problem IT22822 | Status: Closed |
WRONG RESULT WHEN PREDICATE HAS CONCATENATED CONSTANT AND COLUMN. | |
product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
Problem description: | |
Db2 may produce wrong result when the following conditions are met: 1) The query has an equality predicate 2) The equality predicate has a constant string in one side and a constant concatenated with a fixed length character column on the other side 3) The number of characters in the constant part of concatenation is less than the number of characters in the constant used in the other side of the predicate. 4) SYSIBM.NLS_STRING_UNITS is set to 'CODEUNITS32' Example: CREATE TABLE T (C CHAR(4 CODEUNITS32) NOT NULL); insert into T values('BCD'); select * from T where 'ABCD'='A'||C; The expected result is 1 row : C ---------------- BCD 1 record(s) selected. and it generates 0 rows, which is wrong. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * All DB2 LUW Users * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 10.5 Fix Pack 10 or later. * **************************************************************** | |
Local Fix: | |
Rewrite the query by splitting the predicate so that concatenation gets removed: select * from T where 'A'='A' and 'BCD'=C; or rewrite to remove the constant part of the predicate as: select * from T where 'BCD'=C; | |
Solution | |
Workaround | |
not known / see Local fix | |
BUG-Tracking | |
forerunner : follow-up : IT22826 | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 18.10.2017 12.07.2018 12.07.2018 |
Problem solved at the following versions (IBM BugInfos) | |
Problem solved according to the fixlist(s) of the following version(s) |