Quote:
Originally Posted by MxC
Thanks, that's quite useful. Unfortunately it seems it works 10g onwards. I'm having 9i
Any other suggestions that could work in 9i?
|
Wow, that is an ancient version.
(That'll teach you to include your version number, especially when using a non-supported version

)
The only workaround I can see, is to create a function that tries to convert a string to a number and catches all exceptions. If an exception occurred you ignore it and signal that it was not a number, something like:
Code:
create or replace function safe_to_number(to_test varchar)
return integer
is
result integer;
begin
begin
result := to_number(to_test);
exception when others then
result := null;
end;
return result;
end;
/
You will need to adjust the to_number() call to use your expected number format.
But be warned: this is not a really fast solution, especially when you have a lot of exceptions!