IBM Support

IC81009: ROLLUP OR CUBE QUERY MAY RETURN INCORRECT RESULT WHEN IT REFERENCES SAME GROUPING(EXPRESSION) MULTIPLE TIMES

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • A query may return incorrect when all the following conditions
    are met:
    1. Query has GROUP BY with CUBE or ROLLUP operation
    2. Query has GROUPING function present in SELECT or HAVING
    clause that is applied to CUBE or ROLLUP operation
    3. The same GROUPING function is repeated >=2  times
    4. GROUPING function operand is such an expression that contains
    function of literals
    

Local fix

  • Rewrite the query as follows.
    Use CTE (Common Table Expression) to compute one
    GROUPING(EXPRESSION) result at first, and SELECT from CTE and
    reference the grouping result as wanted.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * ALL                                                          *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * A query may return incorrect when all the following          *
    * conditions are met:                                          *
    * 1. Query has GROUP BY with CUBE or ROLLUP operation          *
    * 2. Query has GROUPING function present in SELECT or HAVING   *
    * clause that is applied to CUBE or ROLLUP operation           *
    * 3. The same GROUPING function is repeated >=2  times         *
    * 4. GROUPING function operand is such an expression that      *
    * contains function of literals                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 UDB version 9.7 fixpack 6.                    *
    ****************************************************************
    

Problem conclusion

  • Problem was first fixed in DB2 UDB Version 9.7 FixPack 6.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC81009

  • Reported component name

    DB2 FOR LUW

  • Reported component ID

    DB2FORLUW

  • Reported release

    970

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-01-24

  • Closed date

    2012-06-11

  • Last modified date

    2012-06-11

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

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

    IC81168 IC81169 IC84309

Fix information

  • Fixed component name

    DB2 FOR LUW

  • Fixed component ID

    DB2FORLUW

Applicable component levels

  • R970 PSN

       UP



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC81009

Modified date: 11 June 2012