Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2003, 05:25 AM
Registered User
 
Join Date: Nov 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to select where rownum BETWEEN 50 and 100?

Hi,

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.

Michael





 
Old December 1st, 2003, 12:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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,

Nik
http://www.bigaction.org/





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





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