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: alligatorsql.com <peter_at_fluxx.com>
Date: 6 Jul 2001 04:50:35 -0700
Message-ID: <d01b518e.0107060350.393d059@posting.google.com>

Hello Philippe,

why this code did not compile is already described in this folder but why do you
skip through the hole string to get a valid number back ? The second think : when you pass for ex. "10.2" you will get 102 as a number
back ... is that OK for you ?

So here another function that do nearly the same but without skip through the hole string :)

Function CHAR2NUM_2(p_cVarchar VARCHAR2) RETURN NUMBER IS

   nRet NUMBER;
BEGIN
   nRet := TO_NUMBER(p_cVarchar);
   RETURN nRet;
EXCEPTION
   WHEN OTHERS THEN
       RETURN NULL;
END; This give back a 10.2 ...

I hope this will help you
Greetings
Manfred Peter
(Alligator Company)
www.alligatorsql.com Received on Fri Jul 06 2001 - 06:50:35 CDT

Original text of this message

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