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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Complex ORDER BY clauses

Re: Complex ORDER BY clauses

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Sat, 15 Nov 2003 15:01:35 -0800
Message-ID: <1068937317.663013@yasure>


Matthias Wirtz wrote:

> "Daniel Morgan" <damorgan_at_x.washington.edu> schrieb im Newsbeitrag
> news:1068849441.169822_at_yasure...
>

>>mcstock wrote:

>
>
>>>| SELECT test_col
>>>| FROM (
>>>|     SELECT test_col
>>>|     FROM t
>>>|     ORDER BY test_col)
>>>| ORDER BY DECODE(test_col, 'B', 1, 'E', 2, 99);

>
>
>>>why the double order by?

>
>
>>The original wanted everything ordered with B and E pulled out. The
>>entire set must be ordered first. The outer query only changes the
>>value of the two selected values.

>
>
> I understand what you are trying with this inner query, but this is not
> working for me.
>
> I get the same result when I skip the inner query. B and E are fine but the
> rest is not sorted alphabetically.
>
> Explain plan states clearly the two different plans: with the above query I
> get two sort operations. If I skip the inner query I get only one sort
> operation. But the results are looking the same. Doesn't make sense to me.
> --
> Matthias Wirtz - Norfolk, USA

Because most likely you entered ordered information. Enter it disordered. Or more like the real world ... enter is disordered and then perform multiple updates.

Then try the statements. The ORDER BY is essential.

Or at least some operation that implicitly orders such as a GROUP BY clause.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Sat Nov 15 2003 - 17:01:35 CST

Original text of this message

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