I don't want to use select in select as it's our form block based code which
does not support(involves complete re-write).great, a framework that doesn't support SQL!
it's been a long time since I've looked at this issue, but if you use my approach, I am only looking at NUMBERS and commas - no other characters. I'm not going to debug someone elses approach. You can just replace OC1 (unnest it from the inline view). I used the select of a select for readability. There is no technical reason it has to be a select of a select.
a) Understand what I'm doing
b) re-implement it without using select of a select
ops$tkyte%ORA11GR2> select col1, oc1,
2 case when oc1 is not null
3 then substr( col1, instr(col1||' ',' ')+1)
4 else col1
5 end oc2
6 from (select col1,
7 case when replace( translate( trim(substr( col1, 1,
instr(col1||' ', ' '))),'0123456789','0000000000'), '0', '') is null
8 then to_number( substr( col1, 1, instr(col1||' ', '
')) )
9 end oc1
10 from t )
11 order by oc1, oc2
12 /