| Bug #16888 | Cursor fails to FETCH | ||
|---|---|---|---|
| Submitted: | 30 Jan 2006 0:50 | Modified: | 30 Jan 2006 12:30 |
| Reporter: | Ian Gulliver | ||
| Status: | Duplicate | ||
| Category: | Server | Severity: | S3 (Non-critical) |
| Version: | 5.1.5-alpha-max | OS: | Linux (Debian Etch) |
| Assigned to: | Target Version: | ||
[30 Jan 2006 1:29]
Jorge del Conde
Thanks for your bug report. I was able to reproduce this under 5.0 and 5.1
mysql> call bugproc();
-> //
+------+
| c |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
mysql>
[30 Jan 2006 12:30]
Per-Erik Martin
This is a dubplicate of BUG#5967.

Description: When a cursor column is fetched into a procedure-level variable with the same name as the column, it always fetches NULL. Otherwise, the cursor seems to work normally (fetches the right number of rows, etc.). Simply changing the column or variable names fixes the issue. How to repeat: delimiter // DROP TABLE IF EXISTS test// CREATE TABLE test (c INT)// INSERT INTO test VALUES (5)// DROP PROCEDURE IF EXISTS bugproc// CREATE PROCEDURE bugproc () BEGIN DECLARE c INT; DECLARE cur1 CURSOR FOR SELECT c FROM test; OPEN cur1; FETCH cur1 INTO c; SELECT c; CLOSE cur1; END// CALL bugproc//