mysql>
mysql> delimiter $$
mysql>
mysql> CREATE PROCEDURE myProc()
-> outer_block: BEGIN
-> DECLARE l_status int;
-> SET l_status=1;
-> inner_block: BEGIN
-> IF (l_status=1) THEN
-> LEAVE inner_block;
-> END IF;
-> SELECT 'This statement will never be executed';
-> END inner_block;
-> SELECT 'End of program';
-> END outer_block$$
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
mysql> call myProc();
+----------------+
| End of program |
+----------------+
| End of program |
+----------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.02 sec)
mysql> drop procedure myProc;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql>
|