home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Neueste VersionenFixList
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
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IC62652 Status: Geschlossen

SQL0901N WHEN QUERY USES MULTIPLE XMLAGG WITH ORDER BY CLAUSE IN THE SAME
GROUP BY STATEMENT AND INPUT ARGUMENT NOT NULLABLE.

Produkt:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problembeschreibung:
When a query uses multiple XMLAGG with ORDER BY clause in the 
same GROUP BY statement and the input argument to XMLAGG is not 
nullable, the user might get error SQL0901N "Subsequent SQL 
statements can be processed.(Reason "no cast fcn".)". 
 
For example, with this table definition, 
 
CREATE TABLE customer 
(cust_id       INTEGER         NOT NULL WITH DEFAULT 
,branch#       INTEGER         NOT NULL WITH DEFAULT 
,balance       DECIMAL(12,2)   NOT NULL WITH DEFAULT 
,firstnme      VARCHAR(20)     NOT NULL WITH DEFAULT 
,middlnme      VARCHAR(20)     NOT NULL WITH DEFAULT 
,lastname      VARCHAR(20)     NOT NULL WITH DEFAULT 
,PRIMARY KEY   (cust_id)); 
COMMIT; 
 
If the user issues the following query: 
 
SELECT   branch#                          AS branch# 
        ,COUNT(*)                         AS #cust 
        ,MAX(firstnme)                    AS max_fname 
        ,MAX(middlnme)                    AS max_mname 
        ,MAX(lastname)                    AS max_lname 
        ,XMLAGG(XMLTEXT(firstnme || ' ') 
            ORDER BY firstnme)            AS fname2 
        ,XMLAGG(XMLTEXT(middlnme || ' ') 
            ORDER BY middlnme)            AS mname2 
FROM     customer 
GROUP BY branch# 
ORDER BY branch#; 
 
 
You will receive the following error: 
 
SQL0901N  The SQL statement failed because of a non-severe 
system error. Subsequent SQL statements can be processed. 
(Reason "no cast fcn".) SQLSTATE=58004.
Problem-Zusammenfassung:
**************************************************************** 
* USERS AFFECTED:                                              * 
* none                                                         * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* SQL0901N WHEN QUERY USES MULTIPLE XMLAGG WITH ORDER BY       * 
* CLAUSE IN THE SAME GROUP BY STATEMENT AND INPUT ARGUMENT NOT * 
* NULLABLE.                                                    * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* none                                                         * 
****************************************************************
Local-Fix:
There are two local workarounds: 
 
1. Remove NOT NULL WITH DEFAULT clause in the "create table" 
statement and no change is required on the query. 
 
CREATE TABLE customer 
(cust_id       INTEGER         NOT NULL WITH DEFAULT 
,branch#       INTEGER         NOT NULL WITH DEFAULT 
,balance       DECIMAL(12,2)   NOT NULL WITH DEFAULT 
,firstnme      VARCHAR(20) 
,middlnme      VARCHAR(20) 
,lastname      VARCHAR(20) 
,PRIMARY KEY   (cust_id)); 
COMMIT; 
 
 
2. Rewrite the XMLAGG in the failing query with maximum ORDER BY 
clause. 
 
SELECT   branch#                          AS branch# 
        ,COUNT(*)                         AS #cust 
        ,MAX(firstnme)                    AS max_fname 
        ,MAX(middlnme)                    AS max_mname 
        ,MAX(lastname)                    AS max_lname 
        ,XMLAGG(XMLTEXT(firstnme || ' ') 
            ORDER BY firstnme)            AS fname2 
        ,XMLAGG(XMLTEXT(middlnme || ' ')) AS mname2 
FROM     customer 
GROUP BY branch# 
ORDER BY branch#;
verfügbare FixPacks:
DB2 Version 9.7 Fix Pack 1 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3a for Linux, UNIX, and Windows
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 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 6 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 10 for Linux, UNIX, and Windows

Lösung
Fixed in DB2 v9.5 FP4.
Workaround
keiner bekannt / siehe Local-Fix
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
20.08.2009
01.03.2010
01.03.2010
Problem behoben ab folgender Versionen (IBM BugInfos)
9.5.FP4
Problem behoben lt. FixList in der Version
9.7.0.1 FixList