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
27528
June 27, 2005 09:45AM
9441
June 27, 2005 11:10AM
9979
June 29, 2005 03:54AM
7289
June 30, 2005 05:45AM
5748
September 23, 2005 03:10AM
6595
June 30, 2005 06:30AM
5747
June 30, 2005 09:26AM
5357
June 30, 2005 02:16PM
5732
November 02, 2005 01:41AM
5849
February 13, 2006 03:07AM
7623
February 13, 2006 03:16AM
5935
February 15, 2006 01:58AM
6548
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.