Bug #54000 Allow loops, cursors, etc. to be used outside of stored programs
Submitted: 26 May 2010 15:36 Modified: 27 May 2010 3:32
Reporter: DJ Miller Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: Parser Severity:S4 (Feature request)
Version:5.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: cursor, loop, stored programs

[26 May 2010 15:36] DJ Miller
Some statements (cursors, loops) are only valid in the context of a stored program.  This can be inconvenient for running a quick statement to do something in a loop, such as executing a statement repeatedly based on the results of a query.

While it is possible to temporarily create a stored proc to do the work and drop it when done, it may be desirable for a user to do this who does not have permission to create a stored proc.

How to repeat:
At the mysql command prompt, attempt to use a loop or cursor statement.  Parser returns ERROR 1064.

Suggested fix:
Treat commands no differently than stored procedures, allowing the execution of a compound statement to include statements like while, for, cursor, etc.
[27 May 2010 3:32] Valeriy Kravchuk
This is a duplicate of bug #48777.