Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Rownum (was something else)

Rownum (was something else)

From: <mikharakiri_nospaum_at_yahoo.com>
Date: 4 Oct 2005 11:15:49 -0700
Message-ID: <1128449749.106295.212120@g47g2000cwa.googlegroups.com>

DA Morgan wrote:
> > ROWNUM is a hack that predated analytical SQL extensions, and some of
> > these extensions do make sence for an end user. Otherwise, how do you
> > express the query
>
> Without using ROWNUM please provide the equivalent to the following:
>
> SELECT *
> FROM t
> WHERE rownum < 37;

select * from (
  select row_number() over (order by 0) rn   from t
) where rn < 37

As far as performance concerned, there is no reason why it can't be the same.

Note, that unlike rownum hack, it would also provide an answer with negated predicate

where rn >= 37

and people would stop asking why rownum doesn't return any rows.

BTW, I'm not fan of analytics, but having two constructs in the language doing the same thing is just messy. Received on Tue Oct 04 2005 - 13:15:49 CDT

Original text of this message

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