先转换成数字
SQL> select to_number(replace(substr(col1, 1, 3)||'.'||substr(col1, 4), '0', '')) from test_1;TO_NUMBER(REPLACE(SUBSTR(COL1,1,3)||'.'||SUBSTR(COL1,4),'0',''))
----------------------------------------------------------------
1
1.1
1.11
1.12
1.13
1.2
1.21
1.22
1.23
1.24
1.3
1.31
1.32
1.33
1.34
1.341
1.34217 rows selected.SQL> select * from test_1
2 order by to_number(replace(substr(col1, 1, 3)||'.'||substr(col1, 4), '0', ''));COL1 COL2
------------------------------ --------------------------------------------------
001 高中
001001 高一
001001001 高一1班
001001002 高一2班
001001003 高一3班
001002 高二
001002001 高二1班
001002002 高二2班
001002003 高二3班
001002004 高二4班
001003 高三
001003001 高三1班
001003002 高三2班
001003003 高三3班
001003004 高三4班
001003004001 高三4班1小组
001003004002 高三4班2小组
SQL> select to_number(replace(substr(col1, 1, 3)||'.'||substr(col1, 4), '0', '')) from test_1;TO_NUMBER(REPLACE(SUBSTR(COL1,1,3)||'.'||SUBSTR(COL1,4),'0',''))
----------------------------------------------------------------
1
1.1
1.11
1.12
1.13
1.2
1.21
1.22
1.23
1.24
1.3
1.31
1.32
1.33
1.34
1.341
1.34217 rows selected.SQL> select * from test_1
2 order by to_number(replace(substr(col1, 1, 3)||'.'||substr(col1, 4), '0', ''));COL1 COL2
------------------------------ --------------------------------------------------
001 高中
001001 高一
001001001 高一1班
001001002 高一2班
001001003 高一3班
001002 高二
001002001 高二1班
001002002 高二2班
001002003 高二3班
001002004 高二4班
001003 高三
001003001 高三1班
001003002 高三2班
001003003 高三3班
001003004 高三4班
001003004001 高三4班1小组
001003004002 高三4班2小组
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货