Rechercher dans le manuel MySQL
13.6.1 BEGIN ... END Compound-Statement Syntax
BEGIN ... END
syntax is used for writing compound statements, which can appear
within stored programs (stored procedures and functions, triggers,
and events). A compound statement can contain multiple statements,
enclosed by the BEGIN
and
END
keywords.
statement_list
represents a list of one
or more statements, each terminated by a semicolon
(;
) statement delimiter. The
statement_list
itself is optional, so
the empty compound statement (BEGIN END
) is
legal.
BEGIN ... END
blocks can be nested.
Use of multiple statements requires that a client is able to send
statement strings containing the ;
statement
delimiter. In the mysql command-line client,
this is handled with the delimiter
command.
Changing the ;
end-of-statement delimiter (for
example, to //
) permit ;
to
be used in a program body. For an example, see
Section 24.1, “Defining Stored Programs”.
A BEGIN ...
END
block can be labeled. See
Section 13.6.2, “Statement Label Syntax”.
The optional [NOT] ATOMIC
clause is not
supported. This means that no transactional savepoint is set at
the start of the instruction block and the
BEGIN
clause used in this context has no effect
on the current transaction.
Within all stored programs, the parser treats
BEGIN [WORK]
as the beginning of a
BEGIN ...
END
block. To begin a transaction in this context, use
START
TRANSACTION
instead.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-begin-end.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
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.