Skip navigation links

MySQL Forums :: Stored Procedures :: Capture error messages using DECLARE statements


Advanced Search

Capture error messages using DECLARE statements
Posted by: Cornelius Sybrandy ()
Date: June 27, 2005 09:45AM

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;

Options: ReplyQuote


Subject Views Written By Posted
Capture error messages using DECLARE statements 17946 Cornelius Sybrandy 06/27/2005 09:45AM
Re: Capture error messages using DECLARE statements 6568 Vivian Fonger 06/27/2005 11:10AM
Re: Capture error messages using DECLARE statements 7398 Roland Bouman 06/29/2005 03:54AM
Re: Capture error messages using DECLARE statements 5463 Roland Bouman 06/30/2005 05:45AM
Re: Capture error messages in phpscript 4265 gamut kumar 09/23/2005 03:10AM
Re: Capture error messages using DECLARE statements 4888 Andrew Gilfrin 06/30/2005 06:30AM
Re: Capture error messages using DECLARE statements 4252 Roland Bouman 06/30/2005 09:26AM
Re: Capture error messages using DECLARE statements 4043 Vivian Fonger 06/30/2005 02:16PM
Re: Capture error messages using DECLARE statements 4295 Pavel 11/02/2005 01:41AM
Re: Capture error messages using DECLARE statements 4338 Peter Schwager 02/13/2006 03:07AM
Re: Capture error messages using DECLARE statements 5241 Roland Bouman 02/13/2006 03:16AM
Re: Capture error messages using DECLARE statements 4406 Peter Schwager 02/15/2006 01:58AM
Re: Capture error messages using DECLARE statements 4596 Roland Bouman 02/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.