Bug #49991 Multiple assignments cause exit from a cursor loop in stored procedures
Submitted: 30 Dec 2009 13:14 Modified: 24 Feb 2015 9:27
Reporter: Saverio Miroddi Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.0.85 OS:MacOS
Assigned to: CPU Architecture:Any

[30 Dec 2009 13:14] Saverio Miroddi
Description:
If I have a multiple assignment inside a cursor loop, the loop exits prematurely.

Example (metacode):

loop
  fetch cursor
  leave if cursor not found

  SELECT a,b INTO @a, @b FROM my_table     -- causes an exit from the loop
end_loop

Example of working not exhibiting the behavior:

loop
  fetch cursor
  leave if cursor not found

  SET @a = ( SELECT a FROM my_table)
  SET @b = ( SELECT a FROM my_table)
end_loop

How to repeat:
I repeated every time in two separate routines I used.
A basic code following the explained structure should reproduce it easily.

This bug has been reproduced by at least another member of the forum.
[30 Dec 2009 13:18] Valeriy Kravchuk
Thank you for the problem report. Please, provide exact, complete code at least for the case that does not work.
[31 Jan 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[24 Feb 2015 9:27] Saverio Miroddi
I can't provide feedback anymore, since we've dismissed the code after some time - I also don't have anymore the underlying data.