IBM Support

IC74797: CREATION OF MQT WITH DISTINCT TYPE MAY SUCCEED UNEXPECTEDLY IN NUMBER OR ORA COMPATIBILITY MODE

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • With the number_compat database configuration parameter set to
    ON, creation of a refresh immediate MQT that
    references a distinct type as a group by column may succeed
    unexpectedly, while subsequent updates on the base table of the
    MQT may result in SQL0901N. SQL20058N rc 6 should have been
    returned during table creation.
    
      CREATE DISTINCT TYPE MONEY AS DECIMAL(8,2) WITH COMPARISONS;
      CREATE FUNCTION COUNT(MONEY) RETURNS INTEGER SOURCE
    COUNT(DECIMAL());
      CREATE FUNCTION SUM(MONEY) RETURNS MONEY SOURCE
    SUM(DECIMAL());
    
      create table t1(m1 money, m2 money);
    
      create table t2(m1, sum_m2, count_m2, count_all) as
       (select m1, sum(m2), count(m2), count(*) from t1 where m2 >=
    money(100.00)
        group by m1)
       data initially deferred refresh immediate disable query
    optimization;
    

Local fix

  • Drop the MQT
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * User using NUMBER/ORA compatibility feature                  *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * With the number_compat database configuration parameter set  *
    * to ON, creation of a refresh immediate MQT that references a *
    * distinct type as a group by column may succeed unexpectedly, *
    * while subsequent updates on the base table of the MQT may    *
    * result in SQL0901N. SQL20058N rc 6 should have been returned *
    * during table creation.                                       *
    *                                                              *
    * CREATE DISTINCT TYPE MONEY AS DECIMAL(8,2) WITH COMPARISONS; *
    * CREATE FUNCTION COUNT(MONEY) RETURNS INTEGER SOURCE          *
    * COUNT(DECIMAL());                                            *
    * CREATE FUNCTION SUM(MONEY) RETURNS MONEY SOURCE              *
    * SUM(DECIMAL());                                              *
    *                                                              *
    * create table t1(m1 money, m2 money);                         *
    *                                                              *
    * create table t2(m1, sum_m2, count_m2, count_all) as          *
    *  (select m1, sum(m2), count(m2), count(*) from t1 where m2   *
    * >= money(100.00)                                             *
    *   group by m1)                                               *
    *  data initially deferred refresh immediate disable query     *
    * optimization;                                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to DB2 9.7 Fix Pack 4 or above.                      *
    ****************************************************************
    

Problem conclusion

  • The fix to properly return SQL20058N first appeared in DB2 9.7
    Fix Pack 4.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IC74797

  • 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

    2011-03-02

  • Closed date

    2011-04-28

  • Last modified date

    2011-04-28

  • 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

  • R970 PSN

       UP



Document information

More support for: DB2 for Linux, UNIX and Windows

Software version: 9.7

Reference #: IC74797

Modified date: 28 April 2011