Bug #38386 | Cursor exits ahead of time if it uses assignment with INTO | ||
---|---|---|---|
Submitted: | 25 Jul 2008 20:42 | Modified: | 28 Jul 2008 18:03 |
Reporter: | Snezhana Senchuk | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S3 (Non-critical) |
Version: | 5.0 | OS: | Windows (XP Pro) |
Assigned to: | CPU Architecture: | Any | |
Tags: | cursor, INTO |
[25 Jul 2008 20:42]
Snezhana Senchuk
[25 Jul 2008 21:26]
Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php You removed records from dummy2 where id > 500 and id < 550, so since id = 501 select from dummy2 returns NULL which leads to the not found error when you try to select into a variable. But empty result of select statement is OK, so workaround provided works.
[28 Jul 2008 18:03]
Snezhana Senchuk
Should not 'not found' result for INTO statement return a different error code number? As it says on the site: 'NOT FOUND is shorthand for all SQLSTATE codes that begin with 02. This is relevant only within the context of cursors and is used to control what happens when a cursor reaches the end of a data set.' I would expect 'not found' for INTO to return an error that starts with anything other than 02, since I expect the cursor to terminate only if there is no more data to fetch and not because of some event inside the cursor loop.