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

LOCATE_IN_STRING RETURNS 0 WHEN INSTANCE PARAMETER IS SET TO SMALLINT

product:
DB2 FOR LUW / DB2FORLUW / A50 - DB2
Problem description:
Locate_in_string function should return the starting position of 
a string (called the search-string ) within another string 
(called the source-string). Locate_in_string  returns 0 
when instance parameter is set to SMALLINT. 
Function expects the instance parameter to be type INTEGER, but 
SMALLINT values are not being cast to INTEGER as expected. 
 
LOCATE_IN_STRING ( source-string, search-string, [start], 
[instance], [CODEUNITS16, CODEUNITS32, OCTETS] ) 
 
Here is a simple reproduction of incorrect behaviour, where we 
expect the 
number 2 to be the returned value of the locate_in_string 
function. 
 
$ db2 "values locate_in_string('2,0', ',', 1, cast(1 as 
smallint))" 
1 
----------- 
 0 
1 record(s) selected.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to product DB2 Version 10.5 Fix Pack 5 or higher.    * 
****************************************************************
Local Fix:
The immediate workaround is to use an explicit cast to make the 
parameter an INTEGER value; for example, 
 
$ db2 "values locate_in_string('2,0', ',', 1, cast(1 as 
integer))" 
1 
----------- 
    2 
1 record(s) selected.
Solution
Problem was fixed in DB2 Version 10.5 Fix Pack 5.
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
06.06.2014
18.03.2015
18.03.2015
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)
10.5.0.5 FixList