Documentation Home
MySQL 9.2 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.8Mb
PDF (A4) - 40.9Mb
Man Pages (TGZ) - 259.7Kb
Man Pages (Zip) - 366.9Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.2 Reference Manual  / ...  / SQL Statements  / Compound Statement Syntax  /  Variables in Stored Programs

15.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 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.

For information about the scope of local variables and how MySQL resolves ambiguous names, seeSection 15.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 aSETvar_name = DEFAULT statement). In MySQL 9.2, this results in a syntax error.