oracle 异常字符串转数字(ora-01722错误)

oracle中,在字符串转成数字时,如果字段中存在不能转成功的内容,将会报ora-01722错误,解决方法如下:

select ziduan from table;

1

2

3

4a

5

select case when REGEXP_INSTR(ziduan,'[^[:digit:]]{1,}',1)=0 then to_number(ziduan) end ziduan_new from table;

1

2

3

null

5

原文地址:https://www.cnblogs.com/huangen88/p/5992830.html