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 IC78931 Status: Closed

UNABLE TO SORT DESC ORDER OLAP FUNCTION

product:
DB2 FOR LUW / DB2FORLUW / 950 - DB2
Problem description:
When using the DESC or ASC clause within an SQL statement 
containing an OLAP function, the order may not be enforced 
giving unordered results 
 
e.g. 
db2 "select row_number() over() as num, tabname from 
syscat.tables order by num desc" 
gives an unordered result although DESC is specified.
Problem Summary:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL                                                          * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* see Error Description.                                       * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 v9.5 fp9 or later.                            * 
****************************************************************
Local Fix:
available fix packs:
DB2 Version 9.5 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.5 Fix Pack 10 for Linux, UNIX, and Windows

Solution
First fixed in DB2 v9.5 fp9.
Workaround
There are 2 possible workarounds: 
 
1)"order by 1" 
 
db2 "select row_number() over() as num, tabname from 
syscat.tables 
order by 1 desc" 
 
 
 
2)the OLAP query can be moved into a nested subquery 
 
db2 "select num, tabname from ( select row_number() over() as 
num, 
tabname from syscat.tables ) T order by num desc"
Timestamps
Date  - problem reported    :
Date  - problem closed      :
Date  - last modified       :
27.09.2011
13.03.2012
13.03.2012
Problem solved at the following versions (IBM BugInfos)
9.5.FP9
Problem solved according to the fixlist(s) of the following version(s)
9.5.0.9 FixList