Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Operator Link
On Sun, 17 Oct 2004 07:10:07 -0200, ecaforum
<ecaforum_at_itelefonica.com.br> wrote:
> Friends :
>
> I need to identify in a column if the 3 first characters are about datatye
> number.
Use a function that traps value_error - easier and faster.
Here's an example
create or replace function is_number( chk_data_in varchar2 )
return boolean
is
dummy number(38,4);
begin
dummy := to_number(chk_data_in);
return true;
exception
when value_error then
return false;
when others then
raise;
end;
/
show errors function is_number
declare
v_test varchar2(10) := '1E';
begin
if is_number(v_test) then
dbms_output.put_line(v_test || ' is a number'); else
dbms_output.put_line(v_test || ' is NOT a number');
end if;
end;
/
-- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist -- http://www.freelists.org/webpage/oracle-lReceived on Sun Oct 17 2004 - 06:56:00 CDT
![]() |
![]() |