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: Is it possible to get a subset of a result set?

Re: Is it possible to get a subset of a result set?

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 21 Sep 1999 17:10:22 +0800
Message-ID: <37E74B7E.28EA@yahoo.com>


Steven Hill wrote:
>
> If an _ordered_ query produces a result set of 10,000 rows, for
> example, is possible to retrieve a subset, say, rows 2500 to 3000
> without reading through the first 2499 rows of the result set?
>
> In Oracle, I'd like to use:
>
> select * from employee
> where rownum >= 2500 and rownum <=3000
> order by lastname
>
> Unfortunately, the order by clause is done after the row range is
> retrieved. Ideally, I'd like the solution to use a single select
> statement and not Java or PL/SQL code. Is this possible?
>
> --
> Steven Hill

As of Oracle 8i, an inline select can have an order clause

select *
from ( select * from another_table order by 1,2,3)

--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Tue Sep 21 1999 - 04:10:22 CDT

Original text of this message

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