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: select at offset

Re: select at offset

From: Daniel Morgan <damorgan_at_exesolutions.com>
Date: Tue, 16 Apr 2002 15:06:54 GMT
Message-ID: <3CBC3E08.2B7EBDD4@exesolutions.com>


The only method I know is really ugly and requires repeated queries of the entire table (or tables) unless you wish to pack the result set into an array, a PL/SQL table, or some other similar structure.

Here it is:

SELECT *
FROM (
   SELECT field1, field2, field3, rownum FETCHEDROW    FROM mytable)
WHERE fetchedrow BETWEEN x and y;

If you load the results into something else you would just use the select that forms the in-line view and then select from that again and again and again and again.

Daniel Morgan

Matthias Leonhardt wrote:

> Hi freaks,
>
> I want select some rows of a table and "scroll" through the db like this:
>
> while (select next 5 elements) do write elementblock
> that means I need a select - statement which gets a number of rows at a
> given offset of the db (including getting previous 5 elements)
> select * (10-14) of mytable; to get row 10-14 of the table;
>
> how can I query this in oracle?
>
> thanks for Your help!
>
> bye,
> Matthias Leonhardt
Received on Tue Apr 16 2002 - 10:06:54 CDT

Original text of this message

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