Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一列的值如下
18 ABC 45 XYZ 1 ABC 83 DEF 22 XYZ 4 ABC
我希望它们在从 oracle DB 中提取值时按如下方式排序
1 ABC 4 ABC 18 ABC 22 XYZ 45 XYZ 83 DEF
当我使用 order by 时,substr(column,1)它没有按预期给出结果4 ABC将在22 XYZ之后下降
substr(column,1)
你可以这样做:
order by to_number(substr(column, 1, instr(column, ' ')))
你尝试过类似的东西ORDER BY CAST(substr(column, 2) AS INT)吗?
ORDER BY CAST(substr(column, 2) AS INT)