Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: function to get only numbers

Re: function to get only numbers

From: andrew_webby at hotmail <spam_at_no.thanks.com>
Date: Thu, 5 Jul 2001 11:13:15 +0100
Message-ID: <994327996.13222.0.nnrp-12.c30bdde2@news.demon.co.uk>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US