DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
@p2 = MESSAGE_TEXT;
INSERT INTO my_log (error_message)
SELECT @p2;
END;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1
@p2 = MESSAGE_TEXT;
INSERT INTO my_log (error_message)
SELECT @p2;
END;