| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> order by/case expression problem
The last select statement in the following batch seems to return incorrect
result.
Am I right?
insert into d values ('1')
insert into d values ('10')
insert into d values ('9')
select d from d order by d
d
----------
1
10
select d from d order by cast(d as numeric) d
1 9
select d from d order by
case when 1 = 1 then 1 else cast(d as numeric) end
d
1 10
select d from d order by
case when 1 = 1 then d else cast(d as numeric) end
d
1 9
-- http://www-902.ibm.com/hk/sme/corner/solution_detail.html#a3 http://www.attunity.comReceived on Fri Dec 07 2001 - 23:15:31 CST
![]() |
![]() |