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 First 500 Rows of a Table

Re: Select First 500 Rows of a Table

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 18 Aug 2004 09:49:29 -0700
Message-ID: <4b5394b2.0408180849.26fb6b28@posting.google.com>


melliott42_at_yahoo.com (Michael) wrote in message news:<91721cf.0408180230.570e49fe_at_posting.google.com>...
> Hello all,
>
> Thanks for responding.
>
> It seems Oracle keeps track of records\rows internally using ROWNUM.

NO it does not track records "internally"! The ROWNUM value is assigned at the time the SELECT is executed.

> So for all those in a simliar situation try something like this:
>
> SELECT * FROM mytable WHERE rownum <= 500
>
>
> -Michael

For all those in a simliar situation, you would be much better served either:

defining what you really MEAN by first 500 rows OR
learning how to use a CURSOR (in PL/SQL or embedded SQL) OR BOTH I'm not trying to insult you, Michael, but I've seen this ROWNUM feature get really abused at times. It's not a good idea IMHO to use this in production code.

have a great day.
  ed Received on Wed Aug 18 2004 - 11:49:29 CDT

Original text of this message

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