Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sorting numbers on a VARCHAR2 field
<oracle4444_at_my-deja.com> wrote in message
news:8u57af$ag4$1_at_nnrp1.deja.com...
> Hi-
> Try following stmt. It might work.
> Assuming that column width is 10.......
> select column1 from table1 order by lpad(column1,10,null);
It works but I can't understand why? LPad('1',10,NULL) returns NULL.
I'm used the following solution for sorting character fields as numbers:
select column1 from table1
order by Length(column1), column1
It's probably little bit slower.
Iff Received on Mon Nov 06 2000 - 05:39:56 CST