Re: rownum

From: mrbaker001 <noreply_at_nowhere.com>
Date: Thu, 22 Feb 2001 01:48:09 -0000
Message-ID: <Za_k6.4473$5U3.20806_at_NewsReader>


Others have already come up with answers for Oracle8, but for 7.3+ (maybe earlier) you can still use an in-line view to achieve the result. Although you may not be able to "order by" within it in Oracle 7, I'm pretty sure you can still "group by" on a primary key value, which automatically always sorts (i.e. orders by) as a result.

"Chaz" <chaz_at_hates.spam> wrote in message news:3a7f7a4b_at_newsserver1.intergate.ca...
> can anyone help me find a way to limit the number of records returned in a
> select statement? here's what i mean:
>
> in MS SQL Server, the "TOP n" kewords (as in "SELECT TOP 10 fname FROM
> table") specify how many records *out of the resultset generated from the
> rest of the select statement* are actually returned. in Oracle, the
 closest
> thing I've found is "WHERE rownum <= n". But this rownum is an internal
> index, so it doesn't limit the resultset to the top n of that resultset,
 but
> to records whose rownum is <= n. Theres a huge difference here, and I'm
> totally stumped.
>
> is there a similar keyword in Oracle?
> do i have to spend the next week writing a stored proc to achieve this?
> any clues?
>
> thx in advance.
>
>
>
Received on Thu Feb 22 2001 - 02:48:09 CET

Original text of this message