DB2 - Problem description
Problem IC80668 | Status: Closed |
LIKE CLAUSE MAY RETURN INCORRECT RESULTS FOR VARCHAR COLUMN IN UNICODE DATABASE | |
product: | |
DB2 FOR LUW / DB2FORLUW / 950 - DB2 | |
Problem description: | |
If you have example data below: db2 "insert into t1 values ('a_abc')" db2 "insert into t1 values ('a_bc')" db2 "insert into t1 values ('a__c')" db2 "insert into t1 values ('a2bc')" db2 "insert into t1 values ('aabc')" db2 "insert into t1 values ('abc')" * The above '__' represents one multi-byte underscore charactor in UTF-8. * The above '_' represents one single-byte undersocre charactor in UTF-8. And run below queries: db2 "select * from t1 where NAME LIKE '%a__'" <<-- SQL #1 db2 "select * from t1 where NAME LIKE '%a__a%'" <<-- SQL #2 db2 "select * from t1 where NAME LIKE '%a__b%'" <<-- SQL #3 You will have below different results for char and varchar. type : #1 : #2 : #3 : ------------------------ varchar : 5 : 1 : 1 : <<-- incorrect char : 6 : 1 : 4 : <<-- correct You will have correct results if the column is defined as char. But you will have incorrect results if the column is defined as varchar. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * DB2 UDB Version 9.5. * **************************************************************** * PROBLEM DESCRIPTION: * * See Error description field for more information. * **************************************************************** * RECOMMENDATION: * * Upgrade to Version 9.5 FixPack 10. * **************************************************************** | |
Local Fix: | |
Solution | |
Problem was first fixed in DB2 UDB Version 9.5 FixPack 10. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 05.01.2012 28.08.2012 28.08.2012 |
Problem solved at the following versions (IBM BugInfos) | |
9.5.FP10 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.5.0.10 |