How can I get error text in MySQL stored procedure when SQLEXCEPTION occurs?
I need something like this:
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
INSERT INTO my_log (error_message)
VALUES (SQLEXCEPTION.message);
END;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
@p2 = MESSAGE_TEXT;
INSERT INTO my_log (error_message)
SELECT @p2;
END;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With