Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: numeric check
Hello there,
There is no built in function to accomplish that.
I suggest creating a utiilties package and then putting these types of
functions into that package (ie. isNumber(), etc).
Here's the pl/sql you'll need:
select instr(translate( <insert your variable/string here>
,
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')FROM dual;
If you wanted to check if the string 'HELLO' was a number, it'd be used
like this:
select instr(translate( 'HELLO',
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')FROM dual;
Hope that helps,
Lisa Rafter
mr. ambastha wrote:
> i just have a doubt. till date i was writing a pl sql function for
> checking whether the entered number is numeric or not. can anyone tell
> whether there is any built in function to check this? Earlier i was
> using isdigit() and isnumeric() in other languages. is this kind of
> functions available here?
> thanks in advance,
> regards,
> -ambastha
Received on Fri Mar 24 2006 - 16:12:27 CST