问题撤销!当我拼写正确的一切,问题消失了!
我有一个MySQL存储过程创建一个临时表.当我从mysql提示符调用过程时,它似乎运行成功,但是如果我从临时表中选择COUNT(*),我会收到一个错误,表示该表不存在.
当存储过程结束时,在存储过程中创建的临时表会不再存在吗?
mysql> delimiter //
mysql> drop procedure if exists sp_temp_reciepts//
mysql> create procedure sp_temp_receipts ()
begin
drop temporary table if exists receipts;
create temporary table receipts
( ... snip ...
);
insert into receipts
select ... snip ...
end//
mysql> delimiter ;
mysql> call sp_temp_reciepts();
Query OK, 46903 rows affected, 1 warning (2.15 sec)
mysql> select count(*) from receipts;
ERROR 1146 (42S02): Table 'receipts' doesn't exist