使用临时表时,mysql出现错误--"不能重新打开表:'temporary_name'"

0 人关注

我正在使用python调用一个存储过程,该存储过程创建了一个临时表。

然后我试图从该表中选择,但得到的错误是

Caught an exception while rendering: (1137, "Can't reopen table: 'temporary_name'")

谁能看出我哪里做错了?

my code is

# 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)

该表不叫temporary_name,我只是把它放进去,例如

1 个评论
请给我们提供程序代码。
python
mysql
John
John
发布于 2011-08-05
2 个回答
Vlad
Vlad
发布于 2020-06-07
已采纳
0 人赞同

From MySQL文档 (see bold text):

你不能在同一个查询中多次引用TEMPORARY表。例如,下面的做法就不可行。

mysql> SELECT * FROM temp_table, temp_table AS t2;
ERROR 1137: Can't reopen table: 'temp_table'