DB2 - Problem description
| Problem IT08680 | Status: Closed |
SYSIBM.LEFT & SYSIBM.RIGHT MAY RETURN SQL0138N WHEN THE LENGTH CONSTANT EXPRESSED IN STRING UNITS EXCEEDS STRING LENGTH | |
| product: | |
DB2 FOR LUW / DB2FORLUW / A50 - DB2 | |
| Problem description: | |
SYSIBM.LEFT( string, length contant, string unit ) returns
SQLCODE -138, SQLCODE 22011 when length constant expressed in
string units exceeds string length. This APAR fix will allow
length to exceed string length, the result is padded with blank
characters up to the length. The length argument must be a
constant and the length expressed in the specified string units
mustn't exceed the maximum size of the result data type. The
result data type will have a length equal to the length argument
expressed in the specified string units. For example:
values left('abc',10,codeunits16)
1
--------------------
abc
1 record(s) selected.
the result data type is VARCHAR(20).
The same applies to SYSIBM.RIGHT. | |
| Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * See Error Description * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 version 10.5 fix pack 6 * **************************************************************** | |
| Local Fix: | |
Cast the string argument to a larger size, or convert length to
the default string unit of the input string and omit the string
unit, e.g.:
values left(varchar('abc',20),10,codeunits16)
values left('abc',20) | |
| Solution | |
First fixed in DB2 version 10.5 fix pack 6 | |
| Workaround | |
not known / see Local fix | |
| Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 01.05.2015 25.08.2015 25.08.2015 |
| Problem solved at the following versions (IBM BugInfos) | |
| Problem solved according to the fixlist(s) of the following version(s) | |
| 10.5.0.6 |
|