Re: Limiting Rows Returned in Query

From: <mlanda_at_vnet.ibm.com>
Date: 1996/11/09
Message-ID: <562rga$10fc_at_watnews1.watson.ibm.com>#1/1


In <3283E1D4.57BC_at_c-square.com.nojunk>, Alvin Sylvain <alvin_at_c-square.com.nojunk> writes:
>This may be a FAQ ... but I haven't seen it yet, so, what the hey.
>
>I want to be able to limit the number of rows returned in a query
>statement. I seem to recall something such as:
>
> select columna, columnb
> from tablea
> where 1=1
> and columnc > value
> and maxrows <= 100; <<<<<<<<<<<<<<<<
>
>However, I can not find anything like this in the documentation. (It's
>nice to be able to scan the entire CD-ROM, however, you have to know
>what you're looking for! It's like having a dictionary to help your
>spelling: if you don't know how to spell the word, you can't find it!
>Speaking of which, anyone know how to spell "Medeavil?" Ie, as in
>"Middle Ages"?)
>
>We're using Oracle 7.3.2 on Solaris 2.5.
>
>As a reference, this would be done as follows in Sybase 4.9:
>
> set rowcount 100 <<<<<<<<<<<<<<<<
> select columna, columnb
> from tablea
> where 1=1
> and columnc > value
> go
>
>Any help is appreciated. Please e-mail to:
> alvin_at_c-square.com
>The normal "reply-to" is supposed to be broken to discourage junk
>e-mail.
>
>Thanks!
>========================================================================

Try:

  select columna, columnb
  from tablea
  where 1=1
  and columnc > value
  and ROWNUM <= 100;

M.Landa Received on Sat Nov 09 1996 - 00:00:00 CET

Original text of this message