Home » Developer & Programmer » Reports & Discoverer » check digit
check digit [message #90198] Sat, 04 December 2004 09:02 Go to next message
omar
Messages: 19
Registered: February 2002
Junior Member
helloI

is there in pl/sql a function to check wether a digit is numeric or character like we have in c 'is_numeric() ' or is_digit() functions 
Re: check digit [message #90239 is a reply to message #90198] Sun, 19 December 2004 23:26 Go to previous message
Himanshu
Messages: 457
Registered: December 2001
Senior Member
Hi,
As far as I know there is none.
But you can define your own function for this e.g.:

SQL> Create or replace Function abc(a varchar2) return number is
2 L_num Varchar2(10000):=null;
3 Begin
4 L_num:=to_number(a);
5 return(0);
6 exception
7 when others then
8 return(-1);
9 end;
10 /

Function created.
Now use it in your code:

SQL> Select decode(abc('xyz1'),0,'Numeric',-1,'Alphanumeric') from dual;

DECODE(ABC('
------------
Alphanumeric

SQL>SQL> Select decode(abc('-20'),0,'Numeric',-1,'Alphanumeric') from dual;

DECODE(ABC('
------------
Numeric

HTH
Regards
Himanshu
Previous Topic: reports in html formats
Next Topic: reports exit message?
Goto Forum:
  


Current Time: Mon Nov 25 18:46:12 CST 2024