koushikonjob
asked on
Sorting of number in PTO order
Hi ,
I have a table having only one col. of varchar2 data type .
data are as follows :
1.2
2.0
2.21
8.0
2.2.1
3.0
4.1
3.1
5.1
3.2.4
I want to display is sorted order as :
1.2
2.0
2.2.1
2.21
3.0
3.1
3.2.4
4.1
5.1
8.0
How can I do it
in sql.
!Koushik
I have a table having only one col. of varchar2 data type .
data are as follows :
1.2
2.0
2.21
8.0
2.2.1
3.0
4.1
3.1
5.1
3.2.4
I want to display is sorted order as :
1.2
2.0
2.2.1
2.21
3.0
3.1
3.2.4
4.1
5.1
8.0
How can I do it
in sql.
!Koushik
need anything else?
ASKER
Sorry for late reply... ya its working fine.....
Thanks!!
Koushik
Thanks!!
Koushik
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select your_column from your_table order by your_column
however, on the assumption that you want to sort your data from left-to-right in numeric order by each dot delimited number then try this...
This could be simplified by using a function for comparing values
I've made the assumption here that you will never have more than 9 numeric pieces to your string if that's not correct then adjust "level < 10" to some number big enough
I've also assumed no one number will be greater than 99 , if that's not correct then adjust "power(100," to some number bigger than the largest segment number
Open in new window