IBM Support

IT23228: QUERY USING STATISTICAL VIEW CONTAINING COLUMN GROUP STATISTICS MAY CAUSE SQL0901N

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • hen issuing a query on a statistical view and the statistical
    view has column group statistics (CGS) collected on it, DB2 may
    return a SQL0901N: "column number out of range" error. This will
    only occur when the statistical view definition contains one or
    more UNION ALL set operators.
    
    Example:
    
    CREATE TABLE T1(C1 VARCHAR(23), C2 CHAR(5), C3 INT, C4 INT, C5
    VARCHAR(10));
    CREATE TABLE T2 LIKE T1;
    CREATE VIEW V (C1, C2, C3, C4, C5) AS (SELECT * FROM T1 UNION
    ALL SELECT * FROM T2);
    ALTER VIEW V ENABLE QUERY OPTIMIZATION;
    RUNSTATS ON TABLE V ON COLUMNS ((C1, C2, C3));
    SELECT C4, C5 FROM V WHERE C3 BETWEEN ? AND ?;
    

Local fix

  • If CGS is not needed on the statistical view, CGS can be dropped
    by rerunning the RUNSTATS command without the "ON COLUMNS"
    clause; for example:
    
        RUNSTATS ON TABLE V;
    
    If CGS is required on the statistical view, add the CGS columns
    to the output of the query; for example:
    
        SELECT C1, C2, C3, C4, C5 FROM V WHERE C3 BETWEEN ? AND ?;
    

Problem summary

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

Problem conclusion

  • First fixed in Db2 11.1 Mod 4 Fixpack 5
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT23228

  • 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

    2017-11-20

  • Closed date

    2020-01-18

  • Last modified date

    2020-01-18

  • 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:
03 May 2022