Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 1st, 2003, 05:25 AM
Registered User
Join Date: Nov 2003
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to select where rownum BETWEEN 50 and 100?


I would like to know how to select a certain number of records,
for example, in a web site, we must display a number of records(25) and we must browse them 25 per 25.

how shall I ask Oracle to give me the 25 next records or the 25 previous records?
for example: first time: select A from B where rownum between 1 and 25
             second time where rownum between 25 and 50
and so on...
can you help me?

thanks in advance.


  #2 (permalink)  
Old December 1st, 2003, 12:53 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

This is done with the LIMIT and OFFSET keywords. LIMIT is how many rows to return. OFFSET is the first row of your result set.

Keep in mind that a database stores sets of data -- unless you specify how to order your data, there is no guarantee that the same query will return the result set in the same order. It's always a good idea to use SOME sort of explicit ordering (using ORDER BY <column>) when using LIMIT and OFFSET clauses in your query.

Take care,


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rownum in SQLServer Shais SQL Server 2000 2 December 27th, 2007 07:52 AM
Chap 3 , page 50 MacSr BOOK: Beginning VB.NET Databases 1 January 23rd, 2006 08:53 PM
In rownum subhendude SQL Language 0 December 25th, 2005 02:27 AM
select ONLY records 51-100 in a MySQL table crmpicco Classic ASP Databases 2 February 24th, 2005 07:21 AM
rownum or something like it wanderer SQL Server 2000 1 August 5th, 2003 11:41 AM

All times are GMT -4. The time now is 01:37 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.