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 -> Re: set rowcount

Re: set rowcount

From: Rudy Zung <zungr_at_prograph-inc.com>
Date: Wed, 31 Mar 1999 14:41:02 -0500
Message-ID: <7dttol$4eb$1@mailhost.prograph-inc.com>

joe.morris_at_wcom.com wrote
>Excuse the very elementary question . . .
>
>I have a result set > 10000 rows, however, I only want to see 10
rows, not all
>10000 rows. How do I set the rowcount, or whatever to only return x
# of rows
>instead of the complete result set.
>
>thanks for your help,
>jm
>

select * from foo where rownum < 10

Rownum is a pseudo column that Oracle generates.

NOTE: you cannot do:
select * from foo where rownum > 2
because on the first record, the rownum is 1, so the record is rejected; now
next record becomes the first record, which is also rejected; so the dataset
never even gets its first record for which to compare against if the rownum
is indeed greater than 2. To do something like this would require selecting
the rownum and renaming the column as a subquery, and then selecting those records in the subquery whose renamed rownum column is greater than some happy number that you want.

...Ru Received on Wed Mar 31 1999 - 13:41:02 CST

Original text of this message

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