View Code
create or replace function get_number(str varchar2)
return varchar2 is
v_rs varchar2(4000);
begin
if str is null then
return null;
else
for i IN 1 .. length(str) loop
if ascii(substr(str, i, 1)) between 48 and 57 then
v_rs := v_rs || substr(str, i, 1);
end if;
end loop;
return v_rs;
end if;
end;
select get_number('aa2') from dual;