Home » SQL & PL/SQL » SQL & PL/SQL » Re: Retrieving records N to N+10 !! Perplexed
Re: Retrieving records N to N+10 !! Perplexed [message #22164] Thu, 26 September 2002 10:16
Amit Chauhan
Messages: 74
Registered: July 1999
Member
Hi,
I understand very well that rownum is assigned first and then its been ordered if an order by clause is specified. But just now I tried a query on my Oracle 8.1.7 database, and this has really amazed me.
Its a simple query : (I'll display just the first 10 rows here) :
SELECT email_address, rownum
FROM employee

EMAIL_ADDRESS             ROWNUM
--------------------- ----------
dpeguero                       1
kjohanse                       2
hbonnely                       3
hboye                          4
hballerm                       5
cbinow                         6
fmarkuss                       7
tlindens                       8
vrasmuss                       9
snederg                       10

Now I ran this query again with an order by clause :
SELECT email_address, rownum
FROM employee
ORDER BY email_address
EMAIL_ADDRESS      ROWNUM
--------------     ---------
2arthurs                   1
5pelava                    2
a_nguyen                   3
aaaceves                   4
aaad                       5
aaallen                    6
aaallred                   7
aabarca                    8
aabbas                     9
aabbott                   10


I dont know how the rownum is still in order 1..10 !!!
Can anyone please let me know whats happening here. Is it something new Oracle 8.1.7 ???
Thanks
Amit
Previous Topic: bind balue
Next Topic: Re: Retrieving records N to N+10 !! Perplexed
Goto Forum:
  


Current Time: Mon Apr 29 02:35:56 CDT 2024