Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Boolean Function in SQL
You can write one:
create or replace function MY_IS_NUMBER(test_value in varchar2) RETURN
BOOLEAN IS
l_dummy number;
BEGIN
l_dummy := to_number(test_value);
RETURN(TRUE);
EXCEPTION
WHEN OTHERS
THEN
RETURN(FALSE);
END;
/
John Alexander
www.SummitSoftwareDesign.com
<pmohanan_at_my-deja.com> wrote in message news:8rdfue$db2$1_at_nnrp1.deja.com...
> 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.
>
Received on Tue Oct 03 2000 - 17:20:31 CDT
![]() |
![]() |