日期:2014-05-16 浏览次数:21008 次
with t as ( select '1' b from dual union all select '+2' b from dual union all select '+1' b from dual union all select '2' b from dual union all select '1+' b from dual ) select t.b from t order by decode(instr(t.b,'+'),0,1,1,3,2),replace(t.b,'+','')
------解决方案--------------------
临时拼凑出来的,你可以先将就下,哈哈
WITH tt AS(
SELECT '1' AS A FROM DUAL
UNION ALL
SELECT '+1' FROM DUAL
UNION ALL
SELECT '2' FROM DUAL
UNION ALL
SELECT '2+' FROM DUAL
UNION ALL
SELECT '3' FROM DUAL
UNION ALL
SELECT '4' FROM DUAL
UNION ALL
SELECT '+5' FROM DUAL
UNION ALL
SELECT '5' FROM DUAL
UNION ALL
SELECT '5+' FROM DUAL
)
SELECT * FROM (SELECT * FROM tt WHERE LENGTH(A) = 1
ORDER BY A ASC) K
UNION ALL
SELECT * FROM (SELECT * FROM tt WHERE LENGTH(A) = 2 AND A NOT LIKE '+%'
ORDER BY A ASC)M
UNION ALL
SELECT * FROM (SELECT * FROM tt WHERE LENGTH(A) = 2 AND A LIKE '+%'
ORDER BY A ASC)L
------解决方案--------------------