Labels
Identify blocks and loops for flow control. Labels provide names for BEGIN...END blocks or loops, allowing them to be targeted by LEAVE, ITERATE, or GOTO statements.
Syntax
label: <construct>
[label]ERROR 1309 (42000): Redefining label <label_name>CREATE PROCEDURE `test_sp`()
BEGIN
`my_label`:
LOOP
SELECT 'looping';
LEAVE `my_label`;
END LOOP;
SELECT 'out of loop';
END;Last updated
Was this helpful?

