Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Use of ROWNUM?
Hi!
Check this:
SQL> select count(*) from sys.source$;
COUNT(*)
133278
SQL> select count(*) from sys.source$ sample (1);
COUNT(*)
1405
SQL> select count(*) from sys.source$ sample block (1);
COUNT(*)
873
SQL> Tanel.
"Ramon F Herrera" <ramon_at_conexus.net> wrote in message
news:c9bc36ff.0307220911.1f2c0361_at_posting.google.com...
> I have bee using the ROWNUM constraint for a long time
> in its inequality form:
>
> SELECT somefield FROM mytable WHERE ROWNUM <= 100;
>
> This type of SELECT is very useful at development time,
> to reduce the amount of data returned. However, I was
> wondering whether I can use the ROWNUM in order to retrieve
> one specific record (suppose your data is kind of uninteresting
> in the first rows and you would like to take a look at, say
> record 100). It would be logical to use a statement like this:
>
> SELECT somefield FROM mytable WHERE ROWNUM = 100;
>
> But the equality form above only seems to work for ROWNUM=1.
>
> What I am looking for is something equivalent to awk's NR:
>
> awk 'NR==100 {print $0}'
>
> Thanks for your comments...
>
> -Ramon F. Herrera
Received on Tue Jul 22 2003 - 14:38:58 CDT