Reputation: 77
I've got Mysql 5.5 I created a storred procedure
CREATE DEFINER=`root`@`%` PROCEDURE `refresh_mobileTemp`()
BEGIN
DROP TABLE IF EXISTS mobileTemp;
CREATE TEMPORARY TABLE mobileTemp AS
(SELECT distinct
...
);
END
running
call refresh_mobileTemp();
The temp table is created.
Than I dropped the temp table and created an Event:
CREATE EVENT `schedulerMobileTemp`
ON SCHEDULE every 10 SECOND
ON COMPLETION PRESERVE ENABLE
DO
CALL refresh_mobileTemp();
every 10 seconds in process list appears a process that create the temp table
but than if I call
select * from mobileTemp
it returns: Error Code: 1146. Table 'mobileTemp' doesn't exist
What I'm missing?
Thanks in advance
Upvotes: 0
Views: 28
Reputation: 11393
A TEMPORARY table is visible only to the current session, and is dropped automatically when the session is closed.
It means the temporary table is visible and usable only within the event that creates it.
Upvotes: 3