Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how do you do pagination in a web app with oracle
Possible options would be:
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...Received on Wed Jun 20 2001 - 14:47:43 CDT
> 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
>
>