ORDER BY [message #18632] |
Thu, 07 February 2002 19:24 |
Ramanarsaiah
Messages: 4 Registered: February 2002
|
Junior Member |
|
|
Hi,
I have database column type varchar2. The values may be alfanumeric. My problem is to get the column values in ascending order.i.e like 1,2,3,1A,1ABD,AAB,ACD,DSP etc. Please help me
Thanks
Ramanarsaiah
|
|
|
Re: ORDER BY [message #18636 is a reply to message #18632] |
Fri, 08 February 2002 00:52 |
pratap kumar tripathy
Messages: 660 Registered: January 2002
|
Senior Member |
|
|
Hi,
Try this
create table_name
(col_name varchar2(50));
select col_name from table_name
order by lpad(col_name,50,' ')
/
change 50 with the length of the field.
if u still have problem then give me more data and the sorted list u want.
cheers
pratap
|
|
|
Re: ORDER BY [message #18652 is a reply to message #18636] |
Fri, 08 February 2002 16:10 |
Ramanarsaiah
Messages: 4 Registered: February 2002
|
Junior Member |
|
|
Hi Pratap,
Thanks for your reply.The query is not working.It is true when there is only numeric data. Here I am giving data.
I want to get chargeid in the order.Now the given order is executed by your query, which is
not in ascending order.Please help me.
Thanks,
Ramanarsaiah
ChargeId Varchar2(6)
CHARGE
------
12
11
13
14
15
16
17
18
19
20
21
22
23
24
102
103
104
105
106
107
108
109
110
111
501
502
503
504
1
3
0011
0012
2334
444
00023
45
10001
1221
7
10002
CH345
560
561
562
563
564
0043
0023
0022
5
1APA
K1
K11
K12
1EUA
1NA
1OTR
1UNA
5OBNA
5OBAPA
5OBEUA
5OBUNA
5OBOTR
101
E4
RNK12
|
|
|
|
Re: ORDER BY [message #18678 is a reply to message #18632] |
Sun, 10 February 2002 23:44 |
pratap kumar tripathy
Messages: 660 Registered: January 2002
|
Senior Member |
|
|
hi,
according to your data, the query is giving following result.it sounds nice to me . can u tell me what order you want .change the order(what u want) in the following data and send me back
1
3
5
7
11
12
13
14
15
16
17
18
19
20
21
22
23
24
45
E4
K1
101
102
103
104
105
106
107
108
109
110
111
1NA
444
501
502
503
504
560
561
562
563
564
K11
K12
0011
0012
0022
0023
0043
1221
1APA
1EUA
1OTR
1UNA
2334
00023
10001
10002
5OBNA
CH345
RNK12
5OBAPA
5OBEUA
5OBOTR
5OBUNA
|
|
|