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

Home -> Community -> Usenet -> c.d.o.server -> Re: Simple problem...

Re: Simple problem...

From: Telemachus <telemachus_at_ulysseswillreturn.net>
Date: Fri, 28 Feb 2003 10:13:07 -0000
Message-ID: <UCG7a.12371$V6.16824@news.indigo.ie>


I have to say thanks to everyone. There's been some interesting solutions thus far : let's look :

  1. My own (works but is slow ) - loop through every character of string via SubStr - if not a numeric char (via IN (0..9) then throw an error.
  2. Do a to_number and throw a 6502
  3. Norman's - similar with added stuff on to_float - seems like Round() is faster when checking for a float.
  4. Daniel's modulus solution for is_an_int.
  5. Martin B's Translate Solution which looks kind of nice

What I was trying to do was avoid throwing an error on the conversion ( assume we're branching in a CASE statement)

Martin's Solution looks like it might be fast... I'll give it a whirl.

Thanks all

"Telemachus" <tollg_at_tendwa.rns.net> wrote in message news:zgq7a.12194$V6.16646_at_news.indigo.ie...
> But I can't find an easy solution.
>
> For 817 without rolling your own PL/SQL func...
> Is there a fast builtin way to do IS_A_NUMBER('STRING') or is_a_float()
or
> is_an_integer()
>
>
> i.e. given a string return true if the string represents a valid number
or
> false. Or do most people trap an error from TO_NUMBER ?
>
>
> T ...
>
>
Received on Fri Feb 28 2003 - 04:13:07 CST

Original text of this message

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