Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Next 25 Records

Re: Next 25 Records

From: Smuth Nakpansua <keng_at_enterprise-system.com>
Date: Tue, 09 Mar 1999 02:20:31 +0700
Message-ID: <36E422FE.94E179CD@enterprise-system.com>


Stan wrote:

> Is there a way that I could fetch the first 25 records of a infinite
> sized table, then issue a command to fetch the next 25 records?
> Basically I want to display data in a grid form. The first procedure
> would be to get the first 25 records, then if the user pressed pagedown,
> the grid would display the next 25 records. I don't want to load the
> whole table as this would be very time consuming. I only want to load
> the records that I am displaying.

Try :
  select * from XTABLE where rowid in ( select rowid from XTABLE where rownum <= nRec
  MINUS select rowid from XTABLE where rownum <= (nRec-nRecPerPage));

nRec is record number, e.g. 25, 50, 75... e.g: (nRecPerPage = 25)
(1) First page will be :
  select * from XTABLE where rowid in ( select rowid from XTABLE where rownum <= 25
  MINUS select rowid from XTABLE where rownum <= 0); (2) Second page will be :
  select * from XTABLE where rowid in ( select rowid from XTABLE where rownum <= 50
  MINUS select rowid from XTABLE where rownum <= 25);

Hope this helps.
-smuth

--
~~~
Mr.Smuth Nakpansua (E-mail: keng_at_enterprise-system.com) Enterprise System Company Limited
Home Page: http://enterprise-system.com E-Mail: mailto:info_at_enterprise-system.com

HQ:

    498 Jaran Snitwong 65, Bangbumru,
    Bangplad, Bangkok 10700 THAILAND
Sirindhorn Office:

    56/3 Sirindhorn Road Bangplad,
    Bangkok 10700 THAILAND
    Tel: (+66 2) 4354718-20, 881-1531-2, Fax: (+66 2) 881-1533 Mobile: (+66 1) 488-4489


Received on Mon Mar 08 1999 - 13:20:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US