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

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL help needed

Re: PL/SQL help needed

From: Daniel A. Morgan <dmorgan_at_exesolutions.com>
Date: Mon, 23 Jul 2001 21:38:28 -0700
Message-ID: <3B5CFBC4.14C5B77B@exesolutions.com>

Tony Walby wrote:

> Here is the problem I need to gather data from a table 100 records a a
> time. I need to select 0 -100 then 101 - 200 and so forth I know between
> does not work when using rownum. Plus I see other problems with rownum.
> I was thinking of a cursor with a counter but I do not know how to write
> the pls/sql block any help will be greatly appreciated.
>
> Tony Walby

Or consider this:

SELECT field1, field2, field3
FROM (
   SELECT rownum, field1, field2, field3    FROM mytable
   WHERE rownum <= y)
WHERE rownum BETWEEN x AND y;

Now it is horribly inefficient ... but it does do the job you ask.

Daniel A. Morgan Received on Mon Jul 23 2001 - 23:38:28 CDT

Original text of this message

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