![](/img/trans.png)
[英]How can I create a temporary table using MySQL Connector/Python?
[英]mysql error when using temporary table - “Can't reopen table: 'temporary_name”
我正在使用 python 调用创建临时表的存储过程
然后我试图从该表中进行选择,但出现错误
Caught an exception while rendering: (1137, "Can't reopen table: 'temporary_name'")
谁能看到我哪里出错了
我的代码是
# create a cursor
cur = connection.cursor()
# execute the stored procedure
cur.callproc('nodetree')
# Get results from stored procedure
sql = "SELECT * FROM temporary_name"
cur.execute(sql)
该表不称为临时名称,我只是将其放入例如
来自MySQL 文档(参见粗体文本):
在同一个查询中不能多次引用 TEMPORARY 表。 例如,以下不起作用:
mysql> SELECT * FROM temp_table, temp_table AS t2; ERROR 1137: Can't reopen table: 'temp_table'
如果您在不同别名下的存储函数中多次引用临时表,即使引用出现在函数内的不同语句中,也会发生此错误。
您可以使用通常的表而不是删除它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.