IBM Support

IT26178: WRONG RESULTS FROM SELECT INTO STATEMENT CONTAINING WITH CLAUSE AND DATA-CHANGE-TABLE-REFERENCE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • A SELECT INTO statement with multiple assignment targets may
    assign the results in the wrong order.  This can happen when the
    SELECT INTO statement has all the following characteristics:
    
    - two or more common-table-expressions
    - at least one of the common-table-expressions includes a
    data-change-table-reference
    - multiple assignment-targets
    
    The symptom depends on whether the assignment-targets are
    compatible with the re-ordered select list.  If there is an
    incompatibility, an error is returned at execution time. e.g.:
    
       create table t1 (i int);
    
       CREATE OR REPLACE PROCEDURE P ( out i int, out t time )
       LANGUAGE SQL
       BEGIN
         WITH
         CTE1(I) AS (
             SELECT * from final table( insert into T1 values (1))
         ),
         CTE2(T) as (values current time)
         SELECT CTE1.I, CTE2.T INTO I, T FROM CTE1,CTE2; --
       END
       DB20000I  The SQL command completed successfully.
    
       call p(?,?)
       SQL0303N  A value cannot be assigned to a host variable in
    the SELECT, VALUES,
       FETCH or assignment statement because the data types are not
    compatible.
       SQLSTATE=42806
    
    Otherwise, if no conversion error occurs, assignment-targets
    will have the wrong values.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * See Error Description                                        *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 11.1 Mod 4 Fixpack 4 or higher                *
    ****************************************************************
    

Problem conclusion

  • First fixed in Db2 11.1 Mod 4 Fixpack 4
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT26178

  • 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-09-04

  • Closed date

    2018-11-27

  • Last modified date

    2018-11-27

  • 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":"BU048","label":"IBM Software"},"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:
27 November 2018