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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT STATEMENT

Re: SELECT STATEMENT

From: TurkBear <johng_at_mm.com>
Date: Fri, 25 Aug 2000 16:39:41 GMT
Message-ID: <39a69fa7.6453379@news>

Unless it is very different in PlSql
rownum between x and y will fail if x is anything other than 1

Each record returned is checked to see if it satisfies the where clause; the first record is rownum = 1 , if it is not between x and y ( say x = 4 and y=12) it will be rejected, and the next row will be retrieved - However, this row will still be rownum = 1 and will also fail.......only selected records increment rownum so your lowvalue must be 1

"Joseph Ranseth" <jranseth_at_worldNO_SPAMcupfishing.com> wrote:

>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
  Received on Fri Aug 25 2000 - 11:39:41 CDT

Original text of this message

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