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: Boolean Function in SQL

Re: Boolean Function in SQL

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Wed, 04 Oct 2000 19:21:12 +0800
Message-ID: <39DB12A8.3425@yahoo.com>

pmohanan_at_my-deja.com wrote:
>
> Hi..All,
>
> Is there any function in Oracle which returns 1/TRUE or 0/FALSE
> depending on the condition. I am trying to check whether the value of a
> particluar column is numeric.
>
> When i use to_number(col_name,'99999999') it bombs when it received a
> char_value.
>
> Is there any function like isnumber()? or ischar() in oracle.
>
> The alternative i found was
> substr(col_name,1,1) in ('0','1',.....'9')
>
> Any other alternatives?
>
> Regards,
>
> Praveen
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

select
  decode(
    replace(

      translate(col,'0123456789','@@@@@@@@@@'),
        '@',null),

    null,'IS A NUMBER',
    'IS NOT A NUMBER)
from table

or something similar
HTH

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk

We are born naked, wet and hungry...then things get worse
Received on Wed Oct 04 2000 - 06:21:12 CDT

Original text of this message

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