Rechercher dans le manuel MySQL
13.6.4.1 Local Variable DECLARE Syntax
This statement declares local variables within stored programs.
To provide a default value for a variable, include a
DEFAULT
clause. The value can be specified as
an expression; it need not be a constant. If the
DEFAULT
clause is missing, the initial value
is NULL
.
Local variables are treated like stored routine parameters with respect to data type and overflow checking. See Section 13.1.17, “CREATE PROCEDURE and CREATE FUNCTION Syntax”.
Variable declarations must appear before cursor or handler declarations.
Local variable names are not case-sensitive. Permissible characters and quoting rules are the same as for other identifiers, as described in Section 9.2, “Schema Object Names”.
The scope of a local variable is the
BEGIN ...
END
block within which it is declared. The variable
can be referred to in blocks nested within the declaring block,
except those blocks that declare a variable with the same name.
For examples of variable declarations, see Section 13.6.4.2, “Local Variable Scope and Resolution”.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-declare-local-variable.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.