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: SELECT TOP N

Re: SELECT TOP N

From: Srinivas Chikka <SCHIKKA_at_worldnet.att.net>
Date: 1998/08/14
Message-ID: <6r0hg8$ome@bgtnsc03.worldnet.att.net>#1/1

I don't think that this Statement works. Oracle assings rownum to the records in the order they are fetched and then orders them by the column you specify.

One way of doing this is to declare a cursor order by whatevercolumnyouwant desc,
fetch thru a loop for the n number of times, get the nth record's value.

Hope this helps..

proctorh_at_email.exide.com wrote in message <35d07a59.10897539_at_news.mindspring.com>...
>Oracle select range:
>
>select column
> from table
>where condition
> and rownum = n
>
>where n in the nth row number in the result set.
>you can also use <. >, <=, >=.
>
>I don't know if this is Oracle 8 compliant, though.
>: >

>>: > How about if I want the Nth record only and I want N is a parameter
>>: > passed to a stored procedure. Can I do that?
>>: >
>
Received on Fri Aug 14 1998 - 00:00:00 CDT

Original text of this message

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