Re: Need Help with PL/SQL

From: dan merryman <dan.l.merryman_at_bangate1.tek.com>
Date: 1996/11/06
Message-ID: <328139AE.76BA_at_bangate1.tek.com>#1/1


N Prabhakar wrote:
>
> Use ROWNUM as your selection criteria.
>
> use WHERE ROWNUM < 101.
>
> This will list the first 100 rows. If you need to retrieve only 10 rows,
> use where rownum < 11 in your selection criteria
>
> Hope this helps
>
> N.Prabhakar
> Socgen-Crosby Securities,
> Singapore

Boy, I could make a career out of answering questions by suggesting the use of *in-line views*.

I know that order by will mess up rownum (rownum is assigned as row is fetched from database, prior to sort). Not sure if group by will also mess up rownum, but suspect it will since it does a sort. BUT, by putting the original select *inside* another select as an *in-line view*  the problems of rownum and sorts can be avoided. Try:

select *
from (<original select goes here>)
where rownum <= 100;

Dan



Opinions expressed are not necessarily those of my employer
Received on Wed Nov 06 1996 - 00:00:00 CET

Original text of this message