Bug #20167 Stored procedure selectable and dynamic result set
Submitted: 31 May 2006 15:02 Modified: 30 Jul 2009 17:05
Reporter: Daniel GuimarĂ£es Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.x OS:Any (All)
Assigned to: CPU Architecture:Any

[31 May 2006 15:02] Daniel GuimarĂ£es
Description:
Stored procedure selectable as in Interbase and Firebird:

SET TERM ^ ;

CREATE PROCEDURE ProcTest(Rows INTEGER)
RETURNS(Seq INTEGER, Content VARCHAR(10)) AS
BEGIN
  Seq = 1;
  WHILE (Seq <= Rows) DO
  BEGIN
    Content = 'TEST ' || Seq;
    SUSPEND; 
    Seq = Seq + 1;
  END
END^

SELECT * FROM ProcTest(3)

returns:
+------------------+
| Seq | Content    |
+-----+------------+
|   1 | TEST 1     |
+-----+------------+
|   2 | TEST 2     |
+-----+------------+
|   3 | TEST 3     |
+-----+------------+

SELECT Content FROM ProcTest(3) 
WHERE Seq > 1

returns:
+------------+
| Content    |
+------------+
| TEST 2     |
+------------+
| TEST 3     |
+------------+

How to repeat:
See up.

Suggested fix:
See up.
[30 Jul 2009 17:05] Valeriy Kravchuk
This is a duplicate of Bug #10817 actually.