suche 36x36
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 IT22013 Status: Closed

WRONG RESULT IS POSSIBLE WHEN CODEUNITS 32 IS USED IN A ROW DATATYPE
ASSIGNMENT AND CAST IS USED

product:
DB2 FOR LUW / DB2FORLUW / B10 - DB2
Problem description:
In this example we should return 'ab'  because row has 
varchar(2 CODEUNITS32) - 2 characters, 
but we return 'abc' : 
 
create type rtype as row ( A varchar(2 CODEUNITS32) )@ 
 
create or replace function func001_row() 
 specific func001_row 
 returns varchar(2 CODEUNITS32) 
 language sql 
 no external action 
 begin 
   declare r rtype; -- 
   set r = ( cast('abc' as char(3)) );-- 
   return r.A; -- 
 end@ 
 
values func001_row()@
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See Error Description                                        * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to Db2 11.1 Mod 2 Fix Pack 2 iFix002 or higher       * 
****************************************************************
Local Fix:
avoid cast: 
 
create or replace function func001() 
  specific func001 
  returns varchar(2 codeunits32) 
  language sql 
  no external action 
  begin 
    declare r rtype; -- 
    set r.A = 'abc';-- 
    return r.A; -- 
  end@ 
 
values func001()@ 
 
or avoid row data type: 
create or replace function func001() 
specific func001 
returns VARCHAR(2 CODEUNITS32) 
language sql 
no external action 
begin 
  return cast('abc' as char(3)) ;-- 
end@ 
 
values func001()@
available fix packs:
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

Solution
First fixed in Db2 11.1 Mod 2 Fix Pack 2 iFix002
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
15.08.2017
22.12.2017
22.12.2017
Problem solved at the following versions (IBM BugInfos)
Problem solved according to the fixlist(s) of the following version(s)