Using a Stored Procedure, creating a table and populating the table in a single statement, using a nested select as virtual table for the data, and having that nested select obtain data from a temporary table and call a stored function, causes the references to the temporary table to be lost on all runs after the first. Sequential calls fail with "1146 .Table test,tmpValues doesn't exist'
Code to setup the test and duplicate as follows:
Work arounds exist as follows:
- make the nested select table non temporary
- place another table in the table list of the parent query, in front of the select table (t)
- remove the function reference and replacing it with a constant or value from the temporary table