Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Sequence numbers / ordered queries

Re: Sequence numbers / ordered queries

From: Jurij Modic <jmodic_at_src.si>
Date: Fri, 23 Apr 1999 19:23:14 GMT
Message-ID: <3720c2b2.7421924@news.siol.net>


On Fri, 23 Apr 1999 17:06:09 +0200, "Arjan van Bentem" <avbentem_at_DONT-YOU-DAREdds.nl> wrote:

>Sam Jordan wrote
>> Unfortunately sequences can't be used in ordered queries.
>
>True (well, I think the can be used, but the order might be different than
>you'd expected it to be), but what about
>
> select my_seq.next_val, t1.*
> from
> ( select *
> from my_table
> order by colA, colB, colC
> ) t1
>
>Or, using rownum:
>
> select rownum, t1.*
> from
> ( select *
> from my_table
> order by colA, colB, colC
> ) t1

This will work only in Oracle8i (8.1.*), where ORDER BY is allowed in views (you are using inline view here).

>Arjan.

Regards,
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Fri Apr 23 1999 - 14:23:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US