IBM Support

IT25305: SQL0332N WITH NVL2 FUNCTION AND VARCHAR FOR BIT DATA AND GRAPHIC

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • NVL2 produces error SQL0332N if the first argument is FOR BIT
    DATA and the second and third arguments are GRAPHIC
    (or vice-versa).  For example:
    
    create table MYSCHEMA.TEST (
     graphiccol GRAPHIC(4) -- any other type is fine
    );
    
    All these examples incorrectly produce an error due to mix of
    GRAPHIC and character string FOR BIT DATA:
    
    select  NVL2(RID_BIT(test), test.graphiccol, test.graphiccol)
    FROM MYSCHEMA.TEST test;
    SQL0332N  Character conversion from the source code page "1200"
    to the target code page "0" is not supported.  SQLSTATE=57017
    
    select  NVL2(cast(RID_BIT(test) as varchar(16)),test.graphiccol,
    test.graphiccol)
    FROM MYSCHEMA.TEST test;
    SQL0332N
    
    select  NVL2(cast('blabla' as varchar(16) for bit data) ,
    test.graphiccol, test.graphiccol)
    FROM MYSCHEMA.TEST test;
    SQL0332N
    
    This works fine since the first argument is not FOR BIT DATA:
    
    db2 "select  NVL2(cast('blabla' as varchar(16)) ,
    test.graphiccol,test.graphiccol) as column1
    FROM MYSCHEMA.TEST test"
    
    COLUMN1
    --------
    
      0 record(s) selected.
    

Local fix

  • Cast the GRAPHIC expression(s) to VARGRAPHIC or use the
    equivalent CASE expression instead of NVL2
    
    CASE WHEN expression IS NOT NULL
              THEN result-expression
              ELSE else-expression
         END
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 11.1 Mod 4 Fix Pack 5 or use local fix        *
    ****************************************************************
    

Problem conclusion

  • Fixed in Db2 11.1 Mod 4 Fix Pack 5
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT25305

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-06-08

  • Closed date

    2020-03-10

  • Last modified date

    2020-03-10

  • 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

  • RB10 PSN

       UP

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
04 May 2022