IBM Support

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

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

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

[{"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:
10 March 2020