Home » SQL & PL/SQL » SQL & PL/SQL » Retriving records
Retriving records [message #8187] Sat, 02 August 2003 03:04 Go to next message
tarakvbhatt
Messages: 1
Registered: August 2003
Junior Member
I want to retrieve first 50 records from a table which contains 300 records.
Please give me suggestion regarding this.
Re: Retriving records [message #8189 is a reply to message #8187] Sat, 02 August 2003 03:12 Go to previous messageGo to next message
Pawan
Messages: 33
Registered: June 2002
Member
Check this Query

Select * from emp where rownum <= 50
Re: Retriving records [message #8192 is a reply to message #8189] Sat, 02 August 2003 04:14 Go to previous messageGo to next message
tarak
Messages: 6
Registered: August 2003
Junior Member
What abt exactly 50 th record ?
Thanks for ur reply.
Re: Retriving records [message #8206 is a reply to message #8192] Sun, 03 August 2003 22:21 Go to previous messageGo to next message
Pawan
Messages: 33
Registered: June 2002
Member
Dear Check This

select * from (select rownum a, * from tablename ) where a = 50
Re: Retriving records [message #8208 is a reply to message #8206] Mon, 04 August 2003 00:33 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Look at what Tom Kyte has to say about this. Don't forget to use an ORDER BY, since it is NEVER clear what record will be used by Oracle. An insert of a row and afterwards a delete of the same row can result in a different outcome, although the table content has in fact not changed in the end...

Do as you please but I wouldn't accept such an arbitrary query in one of my applications...

MHE
Previous Topic: Dynanmic SQL(Very very Urgent)
Next Topic: Installation
Goto Forum:
  


Current Time: Fri May 10 10:00:35 CDT 2024