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!

exception handling practices

2901807Mar 11 2015 — edited Mar 12 2015

I'm starting a development project with a new client, they've designed a way of exception handling/logging that I don't believe is the correct. Basically in the plsql they wrap every insert/update/procedure call in a when others exception, make a call to a logging procedure, and set a continue flag=N. The next statement then has to check if the continue flag is Y, then that statement is also wrapped in when others, etc etc. I know this is wrong and want to explain the best approach.

I believe the logging (which is mandatory) only needs to happen once, in an exception block at the end of their procedures. The DML statements can have their own exception handlers (but not 'when others'), which can just raise a custom exception so the logger at the bottom knows which DML failed. When calling another procedure, the called procedure could raise a 'global' exception (defined in a package spec) so the calling proc can then catch the same exception and log it.

Is there a better approach? thanks in advance.

This post has been answered by unknown-7404 on Mar 11 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2015
Added on Mar 11 2015
6 comments
1,480 views