Home » RDBMS Server » Enterprise Manager » getting row number
getting row number [message #67974] Mon, 12 August 2002 02:08 Go to next message
Daniele Rattellini
Messages: 38
Registered: August 2002
Member
How can I get the number (Nth) of a row?
rowid pseudo-column should be unique value for each row, but its format it's not so easy to handle.
Could I obtain row Nth from rowid.

Something like

select rowid_to_nth(rowid) from foo_table;

1
2
3
4
...
100
101

and so on.

Thanks

daniele
Re: getting row number [message #67975 is a reply to message #67974] Mon, 12 August 2002 06:34 Go to previous message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
local@ >select rownum,ename from emp;

    ROWNUM ENAME
---------- ----------
         1 SMITH
         2 ALLEN
         3 WARD
         4 JONES
         5 MARTIN
         6 BLAKE
         7 CLARK
         8 SCOTT
         9 KING
        10 TURNER
        11 ADAMS
        12 JAMES
        13 FORD
        14 MILLER

14 rows selected.

/* to get the 10 row */
local@ >SELECT ename FROM emp WHERE rownum=1 AND rowid NOT IN
  2     (SELECT rowid FROM emp WHERE rownum < 10);

ENAME
----------
TURNER

/*to get the 11th row*/
local@ >SELECT ename FROM emp WHERE rownum=1 AND rowid NOT IN
  2  (SELECT rowid FROM emp WHERE rownum < 11);

ENAME
----------
ADAMS

Previous Topic: Pending Deletion (job)
Next Topic: Oracle management server.
Goto Forum:
  


Current Time: Tue Nov 26 12:00:09 CST 2024