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: how do you do pagination in a web app with oracle

Re: how do you do pagination in a web app with oracle

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Wed, 20 Jun 2001 20:47:43 +0100
Message-ID: <9gqujh$9kg$1@news.chatlink.com>

Possible options would be:

  1. Dump the lot into a global temporary table with a sequencing column added or
  2. As you fetch (presumably in some order), store the "highest" and "lowest" key displayed to the user as defined by your ordering condition in another table. Subsequent displays will do "where key > highest_key" etc.

hth

--
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
"Robert Yeh" <robert.yeh_at_qwest.com> wrote in message
news:9gqbbd$85a$1_at_bob.news.rcn.net...

> Just wondering how does people do their pagination in their web
application
> with Oracle.
> Say my sql returns 1000 rows. My web GUI displays first 50 rows. I have
> page number 1 - 20 showing on my GUI. If user clicks number 11, it
executes
> the same SQL but displays records 501-550.
>
> This is my approach:
>
> 1. do a count(*) of the sql to determine how many rows will be returned.
>
> 2. select field1, field2
> from (select field1, field2, rownum record_number
> from my_table
> where ....)
> where record_number between 501 and 550.
>
> So the SQL always return only 50 rows.
>
>
> Any other suggestions?
>
> Thanks
> Bob
>
>
Received on Wed Jun 20 2001 - 14:47:43 CDT

Original text of this message

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