MySql stored procedures: How to select from procedure table?

mysql, stored-procedures

Solution

Reformulated the question in this thread: Can a stored procedure/function return a table?. Obviously, it isn't possible without the use for temp tables.

Problem

Let's say we have a stored procedure selecting something from a table: ``` CREATE PROCEDURE database.getExamples() SELECT * FROM examples; ``` How can I use the result from this procedure in a later select? (I've tried ``` SELECT * FROM (CALL database.getExamples()) ``` but with no success.) Should I use SELECT... INTO outVariable in the procedure? Or should I use a function returning the table instead?

Original source

Related problems