DECLAREcursor_name
CURSOR FORselect_statement
This statement declares a cursor. Multiple cursors may be declared in a stored program, but each cursor in a given block must have a unique name.
The SELECT
statement cannot have
an INTO
clause.
Local variables should not be declared with the same name as
columns referenced by the SELECT
statement, for reasons described in
Section 12.7.3.4, “Scope and Resolution of Local Variables”.
For information available through
SHOW
statements, it is possible
in many cases to obtain equivalent information by using a cursor
with an INFORMATION_SCHEMA
table.