I am trying to handle SQLExceptions. The database used is Oracle 11g.
The purpose is to show user friendly messages based on the error codes.
To do this, i can find one way to go for error codes.
In the catch i will write switch statement having cases for different error codes and i will show
user friendly messages based on that.
The problem is, i did not found the list of error codes for oracle.
Can anybody please help on this.
In my opinion, most of them are not well suited to be shown to end users. Lots of them are connected to some low-level operation (say, additional space cannot be allocated for table or index). Either the user can administer the database, in which case he'll understand the message, or he cannot, in which case all he needs to do is to pass the message on to a DBA. If he'll pass a user-friendly message instead, the DBA might not understand what happened.
I personally only handle ORA-00001 (unique constraint violated) and ORA-02292 (integrity constraint violated - child record found). There could be a few others to handle this way, but not much. For all others I create an error report (a zip file) that contains the stack trace, log files and other diagnostic information, and display just a generic message ("An error occurred processing XXX. Please send the error report to ..."). Actually, this is how I handle all uncaught exceptions. (It is a Swing application, a web application might manage the error reporting a bit differently.)
Joined: May 13, 2011
Thank you so much Martin for the descriptive link and your sincere suggestion.
subject: SQLExceptions: List of error codes for oracle?