Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: The Winner is ...
Pure Excellence!
Thanks,
Billy
Chrysalis wrote:
> You might like a slightly more compact version written as function which
> can be used in SQL statements (select, insert, update,etc):
> SQL> create or replace function num_x (instr varchar2)
> 2 return varchar2 as
> 3 otstr varchar2 (40);
> 4 begin
> 5 for i in 1 .. length(instr)
> 6 loop
> 7 if substr(instr,i,1) between '0' and '9' then
> 8 otstr := otstr||substr(instr,i,1);
> 9 end if;
> 10 end loop;
> 11 return otstr;
> 12 end num_x;
> 13 /
>
> Function created.
>
> SQL> show errors;
> No errors.
>
> SQL>
> SQL> col rslt format a12;
> SQL> select num_x('9871cb09 8!§i=987') rslt from dual;
>
> RSLT
> ------------
> 9871098987
>
> HTH
> --
> Chrysalis
>
> FABRICATI DIEM, PVNC
> ('To Protect and to Serve')
> Terry Pratchett : "Guards Guards"
Received on Tue Jan 27 1998 - 00:00:00 CST