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: How would you retrieve the first five records

Re: How would you retrieve the first five records

From: Ken Geis <kgeis_at_cchemnt.cchem.berkeley.edu>
Date: Mon, 29 Mar 1999 16:49:46 -0800
Message-ID: <37001FAA.995426DC@cchemnt.cchem.berkeley.edu>

        Oops! I don't know what I was thinking here. Inline views are 7.3.3 and on, but of course you can't order in a subquery until 8i. There are some ugly hacks to get the top N in versions before 8i, though.

Ken

Andrew Babb wrote:
>
> Sorry Ken, but you cannot put an ORDER BY statement in the subquery
> until Oracle8 v8.1.
>
> Rgds
> Andrew
>
> Ken Geis wrote:
>
> > You can actually do this with Oracle 7.3.3 and later.
> >
> > That first line is "select * from" though.
> >
> > Ken
> >
> > Bert Scalzo wrote:
> > >
> > > In Oracle 8i (i.e. 8.1.5) you can do this easily via inline views:
> > >
> > > select *
> > > (select * from employee order by salary)
> > > where rownum <= 5;
Received on Mon Mar 29 1999 - 18:49:46 CST

Original text of this message

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