No cache version.

Caching disabled. Default setting for this page:enabled (code DEF204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher dans le manuel MySQL

13.6.2 Statement Label Syntax

  1. [begin_label:] BEGIN
  2.     [statement_list]
  3. END [end_label]
  4.  
  5. [begin_label:] LOOP
  6.     statement_list
  7. END LOOP [end_label]
  8.  
  9. [begin_label:] REPEAT
  10.     statement_list
  11. UNTIL search_condition
  12. END REPEAT [end_label]
  13.  
  14. [begin_label:] WHILE search_condition DO
  15.     statement_list
  16. 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:

  1. CREATE PROCEDURE doiterate(p1 INT)
  2.   label1: LOOP
  3.     SET p1 = p1 + 1;
  4.     IF p1 < 10 THEN ITERATE label1; END IF;
  5.     LEAVE label1;
  6.   END LOOP label1;

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 Syntax”.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-statement-labels.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut