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: Ed prochak <ed.prochak_at_alltel.com>
Date: 19 Apr 2002 15:43:40 -0700
Message-ID: <e51b160.0204191443.29d8e989@posting.google.com>


Matthias Leonhardt <i7lema_at_rz.uni-jena.de> wrote in message news:<3CBC2BD8.5040204_at_rz.uni-jena.de>...
> 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

Yet another rownum question.

First I have a question, What language are you planning to use?  Obviously, "write elementblock" is not SQL. You will find the clues you need in the language you use.

For example in Pro*C you can do array fetches. I think similar features exist in almost any language that can call ORACLE SQL. Then you need only one SELECT statement invoked.

In contrast, your solution selects only 5 rows at a time, causing a new query to start searching all over again. If you really expect to get back a lot of rows, restarting the query for each set doesn't seem like a good way to get fast performance.

HTH,
Ed Prochak Received on Fri Apr 19 2002 - 17:43:40 CDT

Original text of this message

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