oracle判斷某個字段的值是不是數字?
要先創建一個函數:
create or replace function Isnumber(P_column in varchar2) return numberis l_t number;begin l_t := to_number(P_column) ; return 1; exception when others then return 0;end;測試,如果返回0,則代表不是數字,如果返回值為1則代表是數字。
select Isnumber('100') from dual;select Isnumber('-100') from dual;select Isnumber('100.01') from dual;select Isnumber('a123') from dual;