CREATE OR REPLACE FUNCTION isnum (str IN VARCHAR2) RETURN NUMBER IS v_str VARCHAR2 (1000); BEGIN IF str IS NULL THEN RETURN 0; ELSE v_str := TRANSLATE (str, '.0123456789', '.'); IF v_str = '.' OR v_str = '+.' OR v_str = '-.' OR v_str IS NULL THEN RETURN 1; ELSE RETURN 0; END IF; END IF; END isnum;
扩展判断一列的数据类型是不是数值类型: select * from 表 where not regexp_like(列名,'^[[:digit:]]+$');.