Description:
MySQL calls the handler for the first signaled condition during the execution of a stored
procedure statement, meaning that if a warning is signaled first, it will search for a
handler at that point and if a handler is found it won't look further for other handlers
even if new warning/exception conditions occur.
How to repeat:
create table t1 (a int, b int not null);
delimiter |;
create procedure p()
begin
declare continue handler for sqlwarning select 'warning';
declare continue handler for sqlexception select 'exception';
insert into t1 values (cast('10 ' as signed), NULL);
end|
delimiter ;|
call p();
Although the insert statement throw a exception, only the handler for the warning will be
called because the warning generated by the cast is signaled first.
Description: MySQL calls the handler for the first signaled condition during the execution of a stored procedure statement, meaning that if a warning is signaled first, it will search for a handler at that point and if a handler is found it won't look further for other handlers even if new warning/exception conditions occur. How to repeat: create table t1 (a int, b int not null); delimiter |; create procedure p() begin declare continue handler for sqlwarning select 'warning'; declare continue handler for sqlexception select 'exception'; insert into t1 values (cast('10 ' as signed), NULL); end| delimiter ;| call p(); Although the insert statement throw a exception, only the handler for the warning will be called because the warning generated by the cast is signaled first.