Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Handling ORA-01438 Value Errors

NazbitDec 15 2011 — edited Dec 15 2011
Hi,

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)
This post has been answered by 32685 on Dec 15 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 12 2012
Added on Dec 15 2011
3 comments
2,207 views