create or replace function to_number_force(input in varchar2) return number is a varchar2(2000); b char(1); x number := 1; begin a := ltrim(rtrim(input)); b := substr(a, 1, 1); if(b = '+' or b = '-') then x := 2; end if; while x <= length(a) loop b := substr(a, x, 1); if(b not in ('0','1','2','3','4','5','6','7','8','9','.')) then return NULL; end if; x := x + 1; end loop; return to_number(c); end; /