Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rank(), denseRank() etc...

Status
Not open for further replies.

tpass001

Programmer
Joined
May 30, 2003
Messages
6
Location
US
Hi all,

I am trying to learn DB2 on os390 and this is my version is :
Database server = DB2 OS/390 7.1.1

I was trying to run this query
=====================
SELECT EMPNO, RANK() OVER(ORDER BY EMPNO) AS RANK# ,DENSE_RANK() OVER(ORDER BY EMPNO) AS DENSE# FROM DSN8710.EMP ORDER BY EMPNO
=====================
and i get this error
====================
DBA2191E SQL execution error.

com.ibm.db.DataException: A database manager error occurred. : [IBM][CLI Driver][DB2] SQL0104N An unexpected token "(" was found following "". Expected tokens may include: ", FROM INTO ". SQLSTATE=42601
==================

Any ideas why I am getting this error? I think 7.1.1 should support these functions? I tried these on 3270 but I got the same errors.

Thanks.
 
Looks to me that your syntax is correct, at least it is for DB2 UDB.

Are you sure that DB2 for OS/390 does support OLAP functions?

T. Blom
Information analyst
tbl@shimano-eu.com
 
It looks correct to me also, from what I have read. The OS390 site that I am at does not seem to allow this statement either, but I can find no information to say that this statement is banned on OS390's. Curious.
 
I am not sure if it does. I am new to mainframe development. Does anyone know if it does?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top