PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
MySQL and Linux/Unix
MySQL and macOS
MySQL Partitioning
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL Restrictions and Limitations
Security in MySQL
MySQL and Solaris
Building MySQL from Source
Starting and Stopping MySQL
MySQL Tutorial
MySQL and Windows
MySQL NDB Cluster 7.5
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 useDECLARE to define local variables, and stored routines (procedures and functions) can be declared to take parameters that communicate values between the routine and its caller.
To declare local variables, use the
DECLAREstatement, as described inSection 13.6.4.1, “Local Variable DECLARE Statement”.Variables can be set directly with the
SETstatement. SeeSection 13.7.4.1, “SET Syntax for Variable Assignment”.Results from queries can be retrieved into local variables using
SELECT ... INTOor by opening a cursor and usingvar_listFETCH ... INTO. SeeSection 13.2.9.1, “SELECT ... INTO Statement”, andSection 13.6.6, “Cursors”.var_list
For information about the scope of local variables and how MySQL resolves ambiguous names, seeSection 13.6.4.2, “Local Variable Scope and Resolution”.
It is not permitted to assign the valueDEFAULT to stored procedure or function parameters or stored program local variables (for example with aSET statement). In MySQL 5.7, this results in a syntax error.var_name = DEFAULT
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
MySQL Globalization
MySQL Information Schema
MySQL Installation Guide
MySQL and Linux/Unix
MySQL and macOS
MySQL Partitioning
MySQL Performance Schema
MySQL Replication
Using the MySQL Yum Repository
MySQL Restrictions and Limitations
Security in MySQL
MySQL and Solaris
Building MySQL from Source
Starting and Stopping MySQL
MySQL Tutorial
MySQL and Windows
MySQL NDB Cluster 7.5