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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.