Break out from a procedure with leave statement : LEAVE « Procedure Function « SQL / MySQL






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

1.LEAVE to a label
2.LEAVE with Label out of an inner loop