IBM Support

PI43302: RUNNING IN IDAA, SQLCODE -904 WILL RETURN WHEN QUERY HAS THEN CLAUSES WITH DATE() AND SUBSTR()

A fix is available

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • Running in IDAA, SQLCODE -904 will return when query has THEN
    clauses with DATE() and SUBSTR(), which mixes the DATE and CHAR
    datatype.  For example:
    
    CASE
    WHEN SUBSTR(STG.C_TCKLR_FILD_DATE, 1, 1) = ' ' THEN
    DATE('01/01/1900')
    
    The C_TCKLR_FILD_DATE is a character column.
    
    
    Error during Execute
     57011(-904)[IBM][CLI Driver][DB2] SQL0904N  Unsuccessful
    execution
    caused by an unavailable resource.  Reason code: "00001080",
    type of
    resource: "00E7000E", and resource name: "HY000: ERROR:  CASE
    types
    "DATE" and "CHAR" not matc".  SQLSTATE=57011
    

Local fix

  • Modify the SQL as follows, the THEN clauses for one stmt all use
    CHAR() or SUBSTR(), so the result datatype is CHAR.
    .
    CASE
    WHEN SUBSTR(STG.C_TCKLR_FILD_DATE, 1, 1) = ' ' THEN CHAR(DATE
    ('01/01/1900'))
    .
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: All users of DB2 for z/OS who use query      *
    *                 acceleration.                                *
    ****************************************************************
    * PROBLEM DESCRIPTION: This APAR fixes an SQLCODE -904 when    *
    *                      an accelerated SQL statement that       *
    *                      contains a CASE statement where         *
    *                      the THEN result expressions contain     *
    *                      both a DATE data type and character     *
    *                      data type.                              *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    This APAR fixes an SQLCODE -904 when an accelerated SQL
    statement that contains a CASE statement where the THEN result
    expressions contain both a DATE data type and character data
    type.
    
    One example of such a CASE statement:
    CASE
     WHEN C1= ' ' THEN DATE('01/01/1900')
     WHEN C1= '1' THEN '02/02/2000'
     ELSE DATE('01/01/1900')
    END
    
    For static SQL queries that have been bound for acceleration,
    REBIND the package for the failing query after applying this
    PTF.
    
    Keywords:
    IDAAV4R1/K SQLCASE SQLCODE904
    

Problem conclusion

  • Code is fixed so that the SQL statement executes successfully
    on the accelerator.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI43302

  • Reported component name

    DB2 OS/390 & Z/

  • Reported component ID

    5740XYR00

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-06-17

  • Closed date

    2015-09-10

  • Last modified date

    2015-12-02

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

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

    UI31036 UI31037

Modules/Macros

  •    DSNXONZC
    

Fix information

  • Fixed component name

    DB2 OS/390 & Z/

  • Fixed component ID

    5740XYR00

Applicable component levels

  • RA10 PSY UI31036

       UP15/11/04 P F511

  • RB10 PSY UI31037

       UP15/11/04 P F511

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.



Document information

More support for: DB2 for z/OS

Software version: A10

Reference #: PI43302

Modified date: 02 December 2015


Translate this page: