IBM Support

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

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error 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()@
    

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()@
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 11.1 Mod 2 Fix Pack 2 iFix002 or higher       *
    ****************************************************************
    

Problem conclusion

  • First fixed in Db2 11.1 Mod 2 Fix Pack 2 iFix002
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT22013

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    YesHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-08-15

  • Closed date

    2017-12-22

  • Last modified date

    2017-12-22

  • APAR is sysrouted FROM one or more of the following:

    IT21897

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
22 December 2017