I have a MYSQL stored procedure SP1() that returns a result set.
I want to call SP1() inside of SP2() and loop through the result set of SP1() to do some additional work.
I don’t want to include my logic from SP1() because it would make SP2() too complicated.
Any suggestions?
Thanks.
What you want to do doesnt sound particularly good and maybe you should think about re-designing those 2 procs. However, you could do something like this as a quick fix:
get your sp2 sproc to write it’s intermediate results to a temporary table which you can then access/process inside of sp1. You can then drop the temporary table which you created in sp2 once sp1 returns.
http://pastie.org/883881
not very elegant but should do the trick