2014-11-06 45 views

回答

1

你可以使用正則表達式:

select case when regexp_like(your_string, '^[[:digit:]]+$') then to_number(your_string) else NULL end 
from (select '1d23' your_string from dual); 

對於char(1)

select case when ascii(c) between 48 and 57 then to_number(c) else null end 
from (select '3' c from dual); 

48是用於 '0' 的ASCII碼和57是ASCII碼爲 '9',ASCII功能返回參數的ASCII碼