title: MySQL How to INSERT INTO [temp table] FROM [Stored Procedure]
body: <p>This is very similar to question <a href="https://stackoverflow.com/questions/653714/how-to-select-into-temp-table-from-stored-procedure">653714</a>, but for MySQL instead of SQL Server.</p>
  
  <p>Basically, I have a complicated select that is the basis for several stored procedures.  I would like to share the code across the stored procedures, however, I'm not sure how to do this.  One way I could do this is by making the shared select a stored procedure and then calling that stored procedure from the other ones.  I can't figure out how to work with the result set of the nested stored procedure.  If I could put them in a temp table I could use the results effectively, but I can't figure out how to get them in a temp table.  For example, this does not work:</p>
  
  <pre><code>CREATE TEMPORARY TABLE tmp EXEC nested_sp();
  </code></pre>