I use handler in my function. How to find out if an exception occurred while executing the handler body?
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
INSERT INTO ...
END;
I use handler in my function. How to find out if an exception occurred while executing the handler body?
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
INSERT INTO ...
END;
You can create a HANDLER for your exception and you can set settings or variable values as you like:
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
SET hasError = 1;
And later you can check the value of hasError.
You can do something more complex as well in stored procedures:
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
...
END;