Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

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


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 4:56 PM
Points: 23,400, Visits: 32,256
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
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, September 5, 2014 2:00 PM
Points: 2,163, Visits: 2,191
Lynn,

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

There is some good information and examples here: http://www.techonthenet.com/oracle/exceptions/when_others.php

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: http://awads.net/wp/2006/07/25/how-to-find-where-an-error-was-raised-in-plsql/

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