Re: Need Help with PL/SQL

From: dan merryman <dan.l.merryman_at_bangate1.tek.com>
Date: 1996/10/25
Message-ID: <3270FBDA.12ED_at_bangate1.tek.com>#1/1


Garry M. Filimonov wrote:
>
> Thomas J. Kyte <tkyte_at_us.oracle.com> wrote in article <326d9737.9779201_at_dcsun4>...
> >
> > On Wed, 23 Oct 1996 09:56:17 -0400, "Kevin S. DeWitt" <dewitt_at_interramp.com>
> > wrote:
> >
> > >Thomas J. Kyte wrote:
> > >> (... SELECT skipped ...)
> > >
> > >Will your solution work if there is an ORDER BY
> > >involved? My understanding of rownum is that it is
> > >derived prior to the sort.

> >
> > Correct, you can't use rownum and order by at the same time. You can use group
> > by and rownum together in the above fashion tho. The rownum will be evaluated
> > AFTER the group by has taken place.
> >
> >
> > Thomas Kyte
> > Oracle Government
>
> As I've thought ROWNUM is proccessed BEFORE "GROUP BY" too, because
> "WHERE clause", where it use, evaluate first. Correct me if it isn't truth.
>
> --
> G'luck !
> -----------------------------------------
> Garry M. Filimonov,
> Project Manager & Oracle DBA,
> LASU TRINITI, Troitsk, MR, 142092, Russia
> garry_at_triniti.troitsk.ru
> +7(095)334-0408Well, obviously the best way to be sure is try it with a few small
examples (which I havent taken the time to do) but...

The inner select is esentially a view (an in-line view). The rownum is acting on rows returned from that view. If the 'group by' or 'order by' clause is part of the view definition (which it is in this case) it should not affect the rownum of records coming from that view.

Make sense? Comments? Received on Fri Oct 25 1996 - 00:00:00 CEST

Original text of this message