Home » SQL & PL/SQL » SQL & PL/SQL » ROWNUM not getting from the table (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod,RHEL4)
ROWNUM not getting from the table [message #421080] Fri, 04 September 2009 02:51 Go to next message
anwar786
Messages: 25
Registered: May 2009
Location: bangalore
Junior Member



when i query using <= rownum is displayed
SQL> select rownum,min_salary from jobs where rownum<=3;

ROWNUM MIN_SALARY
---------- ----------
1 20000
2 15000
3 3000


but when using '=' row is not displayed Y?
SQL> select rownum,min_salary from jobs where rownum=3;

no rows selected


Post reply
Re: ROWNUM not getting from the table [message #421082 is a reply to message #421080] Fri, 04 September 2009 02:53 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Roughly put: rownum is assigned after fetching.
First row is fetched => rownum = 1. Compared to your where-clause: 1 != 3, so row is rejected.
Next row is fetched => rownum = 1. Compared to your where-clause: 1 != 3, so row is rejected.
ad inf.

[Updated on: Fri, 04 September 2009 02:54]

Report message to a moderator

Re: ROWNUM not getting from the table [message #421085 is a reply to message #421080] Fri, 04 September 2009 03:07 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Database SQL Reference
Chapter 3 Pseudocolumns
Section ROWNUM Pseudocolumn

Please search and read documentation BEFORE posting already answered question.

Regards
Michel

[Updated on: Fri, 04 September 2009 03:07]

Report message to a moderator

Previous Topic: Sorting
Next Topic: Index 10g
Goto Forum:
  


Current Time: Sat Dec 03 18:03:29 CST 2016

Total time taken to generate the page: 0.08675 seconds