Re: numeric check
- From: yf110@xxxxxxxxxxxxxxxxxxx (Malcolm Dew-Jones)
- Date: 24 Apr 2006 12:03:03 -0800
Ubiquitous (weberm@xxxxxxxxxxx) wrote:
: chrisval@xxxxxxxxx wrote:
: >Malcolm Dew-Jones wrote:
: >> -- untested
: >> function is_a_number( s varchar2)
: >> return number
: >> is
: >> begin
: >> return to_number(s);
: >> exception
: >> -- This should check just the expected error
: >> -- but I haven't bothered to look it up.
: >> when others then
: >> return NULL;
: > end is_a_number;
: >
: >What you're looking for is: "INVALID_NUMBER"
: I thinkthis throws a VALUE_ERROR exception. What's the difference?
: Not to be pedantic, but shouldn't this function return a BOOLEAN
: instead of a NUMBER,
Yes, based on the name of the function, but I assume if you want the
number then you want the number, so I return the number.
The solution would be to change the name, not the function, perhaps
"validated_number", or such like, but good names are hard, so I didn't try
to find one.
.
- References:
- Re: numeric check
- From: Ubiquitous
- Re: numeric check
- Prev by Date: Re: numeric check
- Next by Date: Re: Query with contents of text file.
- Previous by thread: Re: numeric check
- Index(es):