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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get fixed number of rows from the result of SELECT

Re: How to get fixed number of rows from the result of SELECT

From: Sun Guonian <sun_at_cnnic.net.cn>
Date: Mon, 30 Sep 2002 10:02:33 +0800
Message-ID: <3D97B0B9.D0B800D3@cnnic.net.cn>


thanks!

Odd Morten Sveås wrote:
>
> Sun Guonian <sun_at_cnnic.net.cn> wrote in message news:<3D951EE7.A0B0A883_at_cnnic.net.cn>...
> > I have a table with about 1000 records, I want to output
> > them to the webpage only 10 records per page by CGI.
> > when user click next, he will get the next 10 records.
> >
> > I could do it by select them all, but it cost too many time.
> > I wonder if there some better method to do it with SQL.
> >
> > Sun Guonian
>
> Hi
>
> I dont know mutch about PERL but if you can use all the features in
> SQL, you can use a nested select:
>
> select * from (
> select *
> from table
> where rownum < cgi_value * 10 + 1
> order by rownum desc )
> where rownum < 11;
>
> The cgi_value here is an counter that increases by 1 for each time the
> user cliks on next.
>
> Im not sitting on an Oracle base now so i have not tested this SQL,
> but if it dosen't work it should have given you some pointers.

-- 
Sun Guonian
Received on Sun Sep 29 2002 - 21:02:33 CDT

Original text of this message

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