IBM Support

IC69020: DECODE FUNCTION USES UNEXPECTED BLANK-PADDED COMPARISON FOR FIX-LENGTH STRING EXPRESSIONS IN VARCHAR2 COMPATIBILITY MODE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When using the DECODE function in VARCHAR2 compatibility mode,
    the fix-length string expressions are compared using
    blank-padded comparison, which is unexpected.
    
    Here is an example:
    
    db2set DB2_COMPATIBILITY_VECTOR=20
    db2stop
    db2start
    db2 create db sample
    db2 connect to sample
    db2 create table t1 (c1 char(13))
    db2 insert into t1 values('ABCDEFG')
    
    db2 "SELECT '---'||DECODE('1','1         ','ABC', 'DEF') ||
    '---'  FROM t1"
    
       output:    ---ABC---
    
    Expected output is: ---DEF---
    

Local fix

  • Cast the first parameter of DECODE function to VARCHAR.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * When using the DECODE function in VARCHAR2 compatibility     *
    * mode, the fix-length string expressions are compared using   *
    * blank-padded comparison, which is unexpected.                *
    *                                                              *
    * Here is an example:                                          *
    *                                                              *
    * db2set DB2_COMPATIBILITY_VECTOR=20                           *
    * db2stop                                                      *
    * db2start                                                     *
    * db2 create db sample                                         *
    * db2 connect to sample                                        *
    * db2 create table t1 (c1 char(13))                            *
    * db2 insert into t1 values('ABCDEFG')                         *
    *                                                              *
    * db2 "SELECT '---'||DECODE('1','1        ','ABC', 'DEF') ||   *
    * '---'  FROM t1"                                              *
    * output:    ---ABC---                                         *
    * Expected output is: ---DEF---                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 V9.7 Fix Pack 4 or later.                     *
    ****************************************************************
    

Problem conclusion

  • Issue first fixed in DB2 V9.7 Fix Pack 4
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC69020

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-06-04

  • Closed date

    2011-05-09

  • Last modified date

    2011-05-09

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

  • 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

  • R970 PSN

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.7","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
09 May 2011