Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT STATEMENT
Use WHERE ROWNUM BETWEEN x AND y to determine which rows to retrieve.
You might want to create a dynamic SQL statement, and pass the
boundaries.(x,y)
my_query varchar2(4000);
type l_ref_cursor is ref cursor;
my_ref_cursor l_ref_cursor;
my_query := 'Select ROWNUM() as rank, fielda ....fieldx, FROM my table WHERE rownum BETWEEN '||lbound||' AND '||ubound||' ORDER BY rownum';
OPEN my_ref_cursor FOR my_query LOOP
htp.prn( whatever values you want to rint);
END LOOP;
CLOSE my_ref_cursor;
create your links at the bottom of the recordset as follows.
htp.prn('
<a href="my_page?lbound='|| x-10 ||'&ubound='||y-10 ||'">Prev 10</a>
<a href="my_page?lbound='|| x+ 10 ||'&ubound='|| y+10 ||'">Next 10</a>
');
This will requery the recordset each time, which I assume is what you were
looking for.
Lemme know if that's not what you need, or if you need clarification.
hth
-- Joseph Ranseth - Webmaster World Cup Fishing http://www.worldcupfishing.com "Christian Laliberté" <claliberte_at_capitale.qc.ca> wrote in message news:nrvp5.24844$NS6.410948_at_news.globetrotter.net...Received on Fri Aug 25 2000 - 11:11:51 CDT
> Hi everyone,
>
> I would like to make a WEB page containing the result of a search
previously
> perform by the user. I would like to put 10 records in the page and then
> add a next button in the bottom to see the 10 next ones. I can do that
> easily.
>
> No I want a previous button to see the 10 previous records and I don't
want
> the use the javascript function history(-1). I know the first record of
the
> group currently on the screen and I want to select the 10 previous
records.
> How I can do this with a select statement?
>
> Thanks,
> Christian Laliberte
>
>
![]() |
![]() |