MySQL Calling One procedure in another and Inserting values into temporary table
Short answer: This is not possible.
Long answer: This is not possible, but there are workarounds to achieve the same effect.
Option 1: Add a dummy column to your temporary table. Insert all columns from within Proc2
into your temporary table. Then drop the dummy column. Dirty.
Option 2: Add a parameter to Proc2
, a BOOLEAN
is probably a good choice. Insert more or less columns depending on the parameter value. Less dirty.
Option 3: Do you really need Proc2
be a procedure? In other words, does it really modify the data (or more generally, the environment) before selecting data? In other words, wouldn't a view be more suitable in this case?
[edit]
Thanks to James Holderness' pointer, I realized that you may not be aware that a stored procedure has no return value (there is no way around it). I took it for granted that by "Proc2
returns data", you actually meant "Proc2
writes into TempWorkedHrs
some data that Proc1
will read back". If you can, please avoid this approach (either option 1. or 2. is dirty anyways). You most probably need a view here.