开发者

mysql error when using temporary table - "Can't reopen table: 'temporary_name"

i am using python to call a stored procedure which creates a temporary table

i am then trying to select from that table but am getting the error

Caught an exception while rendering: (1137, "Can't reope开发者_开发技巧n table: 'temporary_name'")

can anyone see where i am going wrong

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)

the table is not called temporary_name i just put it in for example


From MySQL documentation (see bold text):

You cannot refer to a TEMPORARY table more than once in the same query. For example, the following does not work:

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

This error also occurs if you refer to a temporary table multiple times in a stored function under different aliases, even if the references occur in different statements within the function.


You can use usual table and than drop it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜