Break out from a procedure with leave statement
DELIMITER $$
CREATE PROCEDURE SMALL_EXIT
(OUT P1 INTEGER, OUT P2 INTEGER)
BEGIN
SET P1 = 1;
SET P2 = 1;
BLOCK1 : BEGIN
LEAVE BLOCK1;
SET P2 = 3;
END;
SET P1 = 4;
END$$
DELIMITER ;
Related examples in the same category