Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Exception Handling Expand / Collapse
Posted Friday, March 11, 2011 4:29 PM



Group: General Forum Members
Last Login: Yesterday @ 5:16 PM
Points: 23,522, Visits: 37,745
We are implementing exception handling in our code and we are trying to determine what line in the proc/func had the error during processing.

We want to log errors to a database table for exception processing that may occur in production so we can easily determine what may have gone wrong.

Any help in this would be greatly appreciated.

Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1077225
Posted Monday, March 21, 2011 12:19 AM


Group: General Forum Members
Last Login: Tuesday, June 30, 2015 9:47 AM
Points: 2,160, Visits: 2,204

I think what you are looking for is the BEGIN ... EXCEPTION ... END; block in Oracle.

There is some good information and examples here:

And here is a link to the Oracle documentation on handling errors.

As for the line number issue, it depends on your version, if you have 10g you are in luck, here is a link with some information:

If you are using a version older than 10g then essentially you need to create a variable and update it throughout your procedure and then use that in the EXCEPTION block to report about where it happened.
Post #1081091
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse