Home  >  Article  >  Database  >  Oracle排序报错“ORA-01722: 无效数字”处理

Oracle排序报错“ORA-01722: 无效数字”处理

WBOY
WBOYOriginal
2016-06-07 17:05:071915browse

Oracle排序报错ldquo;ORA-01722: 无效数字rdquo;处理

问题:

某表名tab,内有一个字符型字型需数值大小排序,,但直接采用to_number、cast等手段均报ORA-01722: 无效数字

解决:

select   t.xzjg   from   tab  t

order by  to_number(translate(t.xzjg, '0123456789.' || t.xzjg, '0123456789.')) asc nulls last

--按数值大小排序,同时把空值排到最后

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn