100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > mysql 存储过程临时表_在MySQL存储过程中创建的临时表的范围

mysql 存储过程临时表_在MySQL存储过程中创建的临时表的范围

时间:2020-04-22 10:36:21

相关推荐

mysql 存储过程临时表_在MySQL存储过程中创建的临时表的范围

问题撤销!当我拼写正确的一切,问题消失了!

我有一个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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。