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: Strange behaviour of SORT

Re: Strange behaviour of SORT

From: Mike Burden <michael.burden_at_capgemini.co.uk>
Date: Thu, 11 Mar 1999 14:33:18 +0000
Message-ID: <36E7D42E.53374D26@capgemini.co.uk>


You don't sort with group by. The order by will return the data in the character set defined by the client. I presume group by uses the character set defined in the database but you shouldn't even assume this. It just happens that the optimizer uses a sort to accomplish a group by. It could use any algorithm it likes.

Using a group by as a sort for from-selects (e.g. select .... from (select .... from ..group by)) can be very useful although naughty. :o)

Olivier TAUPIN wrote:

> Here are two queries and their results :
> I can't explain the differents sort orders.
>
> 1- Sorting with GROUP BY
> select hierarchie from f
> group by hierarchie
>
> Result :
>
> 1
> 11
> 111
> 1111
> 1112
> 1113
> 1114
> 1115
> 1116
> 1117
> 1118
> 1119
> 111A
> 111B
> 111C
> 111D
> 111E
>
> 2- Sorting with ORDER BY
> select hierarchie from f
> order by hierarchie
>
> Result :
>
> 1
> 11
> 111
> 111A
> 111B
> 111C
> 111D
> 111E
> 1111
> 1112
> 1113
> 1114
> 1115
> 1116
> 1117
> 1118
> 1119
>
> Thanks for help
>
> Olivier.
Received on Thu Mar 11 1999 - 08:33:18 CST

Original text of this message

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