Bug #10817 Using resultsets returned by a SP in another SP
Submitted: 24 May 2005 8:46 Modified: 30 Jul 2009 17:01
Reporter: serle shuman Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S4 (Feature request)
Version:5.0.0 OS:Any (all)
Assigned to: CPU Architecture:Any

[24 May 2005 8:46] serle shuman
Description:
Retreiving multi-row result sets from stored procedures called from other stored procedures is not supported. I think this ability is critical to being able to create modular re-usable stored procedures. At the moments I just can't get at the results constructed by my stored procedure from the calling stored procedure, which means that I need to replicate the same code in multiple places and also end up with many large stored procedures.

How to repeat:
enhancement request

Suggested fix:
One suggestion would be to be able to use the call statement in an: 

INSERT ... SELECT type manner 

or 

CREATE TEMPORARY TABLE... SELECT type manner 

where the selects could either be replaced with the CALL syntax or the call of the stored procedure could be made available for use within the SELECT statement i.e. 
SELECT sp(x, y, z). As a result, the INSERT..SELECT and CREATE TABLE ...SELECT would work. 

Going further, one could reduce the need for explicit, intermediate temporary table storage, by allowing the stored procedure to produce a result set that could be used (via an alias) in the FROM clause of a SELECT statement, in the same way that other tables/resultsets are used and aliased.
[3 Jul 2005 17:58] Joss
Hi !

Just to say that I totally agree with you serle shuman. It sounds just crazy not to be able to use the resultset of an sp from another one. I'm really looking forward to being able to use this NEW feature.

See ya.
[30 Jul 2009 17:01] Valeriy Kravchuk
Thank you for the reasonable feature request.
[30 Jul 2009 17:04] Valeriy Kravchuk
Bug #31716 was marked as a duplicate of this one.
[30 Jul 2009 17:06] Valeriy Kravchuk
Bug #20167 was marked as a duplicate of this one.
[31 Jul 2009 5:59] Valeriy Kravchuk
Bug #46481 was marked as a duplciate of this one.
[20 Sep 2009 16:22] Valeriy Kravchuk
Bug #47458  was marked as a duplicate of this one.
[29 Sep 2009 12:20] Valeriy Kravchuk
Bug #12899 was marked as a duplicate of this one.