check if “it's a number” function in Oracle

后端 未结 16 2758
一整个雨季
一整个雨季 2020-11-28 10:31

I\'m trying to check if a value from a column in an oracle (10g) query is a number in order to compare it. Something like:

select case when ( is_number(myTab         


        
16条回答
  •  遥遥无期
    2020-11-28 10:53

    well, you could create the is_number function to call so your code works.

    create or replace function is_number(param varchar2) return boolean
     as
       ret number;
     begin
        ret := to_number(param);
        return true;
     exception
        when others then return false;
     end;
    

    EDIT: Please defer to Justin's answer. Forgot that little detail for a pure SQL call....

提交回复
热议问题