DECLARE Statement [ begin_label :] REPEAT statement_list UNTIL  search_condition END REPEAT [ end_label ] [ begin_label :] WHILE  search_condition  DO statement_list END WHILE [ end_label ] Labels are permitted for  BEGIN ... END  blocks and for the  LOOP ,  REPEAT , and  WHILE  statements. Label use for those statements follows these rules: • begin_label  must be followed by a colon. • begin_label  can be given without  end_label . If  end_label  is present, it must be the same as begin_label . • end_label  cannot be given without  begin_label . •Labels at the same nesting level must be distinct. •Labels can be up to 16 characters long. To refer to a label within the labeled construct, use an  ITERATE  or  LEAVE  statement. The following example uses those statements to continue iterating or terminate the loop: CREATE PROCEDURE doiterate(p1 INT) BEGIN label1: LOOP SET p1 = p1 + 1; IF p1 < 10 THEN ITERATE label1; END IF; LEAVE label1; END LOOP label1; END; The scope of a block label does not include the code for handlers declared within the block. For details, see Section 13.6.7.2, “DECLARE ... HANDLER Statement” . 13.6.3 DECLARE Statement The  DECLARE  statement is used to define various items local to a program: •Local variables. See Section 13.6.4, “Variables in Stored Programs” . •Conditions and handlers. See Section 13.6.7, “Condition Handling” . •Cursors. See Section 13.6.6, “Cursors” . DECLARE  is permitted only inside a  BEGIN ... END  compound statement and must be at its start, before any other statements. Declarations must follow a certain order. Cursor declarations must appear before handler declarations. Variable and condition declarations must appear before cursor or handler declarations. 13.6.4 Variables in Stored Programs System variables and user-defined variables can be used in stored programs, just as they can be used outside stored-program context. In addition, stored programs can use  DECLARE  to define local variables, 2797