Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Does Oracle SQL Have TOP Keyword?
Thanks much for the sample, looks like it does the same thing.
Dianne Siebold
MyNudeHaircut <mynudehaircut_at_aol.com> wrote in message
news:20000527101550.18355.00000376_at_ng-ca1.aol.com...
> Dianne,
> I'm just learning Oracle myself, so there may be a better way to do this,
but
> here is one way:
>
> There is a pseudo column named ROWNUM that is not stored in the database
but is
> available for every record retrieved from the database. The ROWNUM column
> changes every time a query is executed and is assigned to the result
records
> one by one sequentially. Therefore the ROWNUM for the first record
received is
> 1, the second record is 2, etc. This can be used to limit the resultset,
like
> so:
>
> SELECT ROWNUM, customer_name
> FROM s_customer
> WHERE ROWNUM < 6;
>
> Because ROWNUM is assigned upon retrieval, it is assigned prior to any
sorting.
> Therefor the particular ROWNUM will not necessarily correspond to the
sorting
> order.
>
> No great Oracle knowledge here, this is from my Oracle PL/SQL book. Hope
it
> helps.
>
>
Received on Sun May 28 2000 - 00:00:00 CDT