How can you tell if a value is not numeric in Oracle?

前端 未结 6 1193
渐次进展
渐次进展 2020-11-27 05:37

I have the following code that returns an error message if my value is invalid. I would like to give the same error message if the value given is not numeric.



        
6条回答
  •  独厮守ぢ
    2020-11-27 05:59

    The best answer I found on internet:

    SELECT case when trim(TRANSLATE(col1, '0123456789-,.', ' ')) is null
                then 'numeric'
                else 'alpha'
           end
    FROM tab1;
    

提交回复
热议问题