"J A" <my_data_storage_65@stripped> wrote on 03/01/2006 11:08:10 AM:
> Does MySQL have support for temporary tables inside stored procedures?
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's
FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
Yes, you can create and destroy temporary tables from within stored
procedures.
Remember that all temporary tables and user variables are
connection-specific. You have to maintain the connection between SPROC
executions to have the results of one SPROC be available to the next. Drop
a connection and your user variables and temporary tables created by that
connection go away (garbage collected by the server).
The obverse situation is also true. Using a pooled connection may result
in object carry-over from one process to another (because returning the
connection to the pool does may not actually drop the connection). You
should always destroy any temporary object when you are through using it
and always initialize your variables before usage. That way you don't
accidentally hand old data off to following threads and you don't inherit
previous threads state values (unless you really want them).
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine