Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to use 'Top' in oracle?
Could you clarify something for me?
Is "allowing ORDER BY inside views" something that must be enablked somewhere in Oracle 8.0.5 - or is it not possible at that level?
David
"Jonathan Lewis" <jonathan_at_jlcomp.demon.co.uk> wrote in message
news:969963920.23651.0.nnrp-10.9e984b29_at_news.demon.co.uk...
>
> There is a change in 8.1, and rownum can be applied after order by,
> but I think you have to use an inline view to achieve it, viz:
>
> select * from
> (
> select product_name
> from product
> order by price DESC
> )
> where rownum<=3
> ;
>
> This is a side-effect of allowing ORDER BY inside
> views rather than an explicit re-implementation of
> the ROWNUM concept.
>
>
> --
>
> Jonathan Lewis
> Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
>
> Niall Litchfield wrote in message <8qpsat$4j5$1_at_soap.pipex.net>...
> >"NetComrade " <andreyNSPAM_at_bookexchange.net> wrote in message
> >news:37ed628d.26437414_at_news.earthlink.net...
> >> select product_name from product order by price where rownum<=3 in 8i
> >> only.
> >
> >Does this mean that rownum has changed in 8i to work on the basis of
rank.
I
> >must have missed that one if it did, and I kinda doubt it. Jonathon and
> >basavaraj have given the two text book ways to achieve this.
> >
> >
> >--
> >Niall Litchfield
> >Oracle DBA
> >Audit Commission UK
> >
> >
>
>
Received on Tue Oct 03 2000 - 12:55:52 CDT
![]() |
![]() |