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 to fetch the first n rows only for a query

Re: how to fetch the first n rows only for a query

From: Howard J. Rogers <howardjr2000_at_yahoo.com.au>
Date: Wed, 24 Jul 2002 13:13:11 +1000
Message-ID: <ahl5uj$328$1@lust.ihug.co.nz>


Don't get too carried away... ROWID is not the same thing as ROWNUM at all, and ROWID is still bad to use in a relational database, because you have no control whatsoever over what rows get which rowids. And once assigned a rowid, a row always retains that same rowid (with one or two exceptions introduced in Oracle 8i). So a test on rowid<x.x.x.x would always return exactly the same set of rows, regardless of what order by clause you put in, or what changes you make to the data.

But ROWNUM is assigned once a row has been selected. And that's why the 'ROWNUM<x' thing works.

Regards
HJR "Fan Ruo Xin" <fanruox_at_yahoo.com> wrote in message news:3D3E07EE.72CC7B8D_at_yahoo.com...
> Thanks for the response from you all!!!
> I always forget "rowid/rownum". I used to think "rowid" is not a good idea
> when you use SQL for relational DBMS. Now I chang my thinking.
> Regards,
>
>
> Fan Ruo Xin wrote:
>
> > Hi,
> > I have a very simple query like,
> > SELECT ...
> > FROM MyTable
> > WHERE
> > ORDER BY
> >
> > Both the tablesize of mytable and result size are very big. I only care
> > the first 10 or 20 rows from the result set. How to implement it in
> > ORACLE?
> > BTW, I searched SELECT stmt in SQL Reference, got no help.
> >
> > Regards,
> > Fan Ruo Xin
>
Received on Tue Jul 23 2002 - 22:13:11 CDT

Original text of this message

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