Handling ORA-01438 Value Errors
NazbitDec 15 2011 — edited Dec 15 2011Hi,
I wonder if anyone can offer any advice on the following problem.
I have a PL/SQL package running as a batch job that is inserting hundreds of rows in to about eight different tables. For various reasons invalid data is creeping in on a fairly regular basis.
The main issue is attempting to insert numbers in to a column that is defined as number (7,2) where given data is too large, obviously this throws the error:
ORA-01438: value larger than specified precision allowed for this column*
Now what I want to do is log the details of the row that caused the error but I cant catch it in the exception handler.
I've tried using When Value_Error but this error doesn't seem to fall in to that handler, it drops in to the When Others instead.
So what do I need to do to catch and handle this particular error?
Also worth noting - I don't want to change the table definition to allow these inserts because its invalid data, and I don't really want to do logical tests on each variable before the insert because there are hundreds of them, ideally I just want to let it try the insert, fail and then catch it.
Thanks in advance for any replies!
(Oracle 10g R2 / Sun OS)