Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: function to get only numbers
Instead of stabbing away at it, why not look up the syntax for "create function". The answer is there.
You should not specify (5) in the first line. It's all in the manual.
"Philippe Makowski" <makowski.philippe_at_wanadoo.fr> wrote in message
news:9i1562$s04$1_at_wanadoo.fr...
> I still have compile error with :
>
> CREATE OR REPLACE FUNCTION char2num (charnum in varchar2(5)) RETURN number
> IS
> longueur number;
> current_digit char(1);
> parsechar varchar2(6);
> BEGIN
> parsechar :='0';
> longueur := length(charnum);
> for i in 1..longueur loop
> current_digit := SUBSTR(charnum, i, 1);
> if current_digit between '0' and '9' then
> parsechar := parsechar || current_digit;
> end if;
> end loop;
> return to_number(parsechar);
> END char2num;
>
>
>
Received on Thu Jul 05 2001 - 05:13:15 CDT
![]() |
![]() |