Description:
I have an inner compound statement within an outer compound statement,
BEGIN ... BEGIN ... END ... END.
Both the inner and outer compound statements have a handler for SQLEXCEPTION.
I cause an error within the inner compound statement.
But the inner compound statement's handler does not catch the error.
The outer compound statement's handler catches the error.
(This would be acceptable if the error was within the inner compound statement's
DECLARE, but that's not the case.)
How to repeat:
mysql> create procedure p1 () begin declare exit handler for sqlexception select '1'; begin
declare exit handler for sqlexception select '2'; drop table if exists tqq; select * from tqq;
end; end;//
Query OK, 0 rows affected (0.00 sec)
mysql> call p1()//
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)