Capture error messages using DECLARE statements
Hello,
I'm writing a stored procedure and I would like to enhance it's error handling capabilities. Currently, it will do a rollback on any error condition. However, I would like to be able to log the message to an error log table. How do I capture the error message? I thought about using the SHOW ERRORS command, but how would I get the error message into a variable? I've seen nothing in the documentation so far that helps.
Just as an FYI, here's what I would like to be able to do:
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
**Get error message**;
INSERT INTO error_log (error_code, error_message) VALUES (error_code_var, error_msg_var);
END;
Subject
Views
Written By
Posted
Capture error messages using DECLARE statements
27303
June 27, 2005 09:45AM
9360
June 27, 2005 11:10AM
9872
June 29, 2005 03:54AM
7206
June 30, 2005 05:45AM
5664
September 23, 2005 03:10AM
6449
June 30, 2005 06:30AM
5664
June 30, 2005 09:26AM
5288
June 30, 2005 02:16PM
5670
November 02, 2005 01:41AM
5772
February 13, 2006 03:07AM
7540
February 13, 2006 03:16AM
5859
February 15, 2006 01:58AM
6457
February 15, 2006 03:11AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.