home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Latest versionsfixlist
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Have problems? - contact us.
Register for free anmeldung-x26
Contact form kontakt-x26

DB2 - Problem description

Problem IC74797 Status: Closed

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

product:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
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;
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.                      * 
****************************************************************
Local Fix:
Drop the MQT
available fix packs:
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Solution
The fix to properly return SQL20058N first appeared in DB2 9.7 
Fix Pack 4.
Workaround
not known / see Local fix
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
02.03.2011
28.04.2011
28.04.2011
Problem solved at the following versions (IBM BugInfos)
9.7.,
9.7.FP4
Problem solved according to the fixlist(s) of the following version(s)
9.7.0.4 FixList