Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Select First 500 Rows of a Table
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