check digit [message #90198] |
Sat, 04 December 2004 09:02 |
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 |
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
|
|
|