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: Get first 10 records?

Re: Get first 10 records?

From: Venkatnarayan Hariharan <venkatnaraya.hariharan_at_oracle.com>
Date: Wed, 24 Oct 2001 13:40:48 -0700
Message-ID: <3BD7274F.649A897E@oracle.com>


If you DONT have an ORDER-BY:
select <SEL-LIST> from <FROM-LIST> where <WHERE-PREDICATES> and rownum < 11

If you have an ORDER-BY:
select <SEL-LIST> from (select <SEL-LIST>, rank() over (order by <ORDER-BY>) as r from <FROM-LIST> where <WHERE-PREDICATES>) where r < 11

RANK() is an analytic function (similar to Time Series option/cartridge in 8.0.x releases). See the "Datawarehousing guide" for more details on analytic-functions.

/Venkat

harry wrote:

> Using Oracle 8i 8.1.7
>
> Is it possible to return just the first say 10 records from a select statment?
>
> thanks
>
> harry


Received on Wed Oct 24 2001 - 15:40:48 CDT

Original text of this message

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