Is there any way to fetch the column name name for which SQL exception occurred?
For example a table MyTable is defined as --
UID NOT NULL NUMBER
Now if issue following insert it will raise ORA-01722-
INSERT INTO testchild VALUES(5, 'tes')
as AGE column expects a number, but we are providing a string.
So i want in my JDBC program to get for which column (here age) this error occurred.
Unfortunately, Oracle doesn't report name of the column that "caused" the exception, most probably because this exception could generally occur in any expression, even in expressions that relate either to none, or several columns at once. I don't know of any way to overcome this.
Edit: you should carefully avoid implicit conversions in your code; if you do, you won't encounter this exception. When searching for a bug lurking in the code, you could employ either extensive logging or debugging to nab (and crush! ) the bug.
Joined: May 13, 2011
Thank you all for posting the reply.
Though there was not a exact answer, but some how satisfying response.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com