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
27295
June 27, 2005 09:45AM
9359
June 27, 2005 11:10AM
9871
June 29, 2005 03:54AM
7204
June 30, 2005 05:45AM
5663
September 23, 2005 03:10AM
6447
June 30, 2005 06:30AM
5660
June 30, 2005 09:26AM
5286
June 30, 2005 02:16PM
5670
November 02, 2005 01:41AM
5769
February 13, 2006 03:07AM
7538
February 13, 2006 03:16AM
5856
February 15, 2006 01:58AM
6455
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.