View previous topic :: View next topic
|
Author |
Message |
Kiranmayee
New User
Joined: 09 Jan 2008 Posts: 25 Location: India
|
|
|
|
I want to number the returned rows from a select query sequentially.
SELECT C_ID,S_SEQ,
ROWNUMBER() OVER (ORDER BY S_SEQ DESC) AS NUM
FROM VNT;
I am getting the following error:
SQLCODE = -104, ERROR: ILLEGAL SYMBOL "(". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: , FROM INTO
Can any one please correct my query. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Code: |
ROWNUMBER()
OVER (...) |
Are these two user defined functions? |
|
Back to top |
|
|
Kiranmayee
New User
Joined: 09 Jan 2008 Posts: 25 Location: India
|
|
|
|
No they are not user defined. I searched in net and got his syntax. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
For which vendors version of SQL? |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Is this okay?
Code: |
SELECT C_ID,
S_SEQ,
ROW_NUMBER() OVER (ORDER BY S_SEQ DESC) AS NUM
FROM VNT; |
|
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
I think your net search was wrong. That seems more like Oracle syntax to me.
Have you looked in the DB2 SQL Reference Manual? I did a search of it for Row_Number and it returned 0 results for it as a function to number rows. I also did OVER( and got no results. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
Back to top |
|
|
|