V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
RayWeil
V2EX  ›  MySQL

请教存储过程中临时表不能重复调用的问题

  •  
  •   RayWeil · Feb 2, 2015 · 4789 views
    This topic created in 4110 days ago, the information mentioned may be changed or developed.
    MySQL小白,最近在写一个存储过程用到了临时表。发现MySQL中临时表的有效期和SQL Server好像不一样。网上看到相关的资料说一个查询中,一个临时表只能出现一次。现在我碰到的问题是,我一个存储过程中需要调用多次某个临时表。在调用这个存储过程时,会收到错误提示说can't reopen table ’表名‘。

    请教,这种情况我该怎么处理?
    1 replies    2015-02-02 01:09:06 +08:00
    RayWeil
        1
    RayWeil  
    OP
       Feb 2, 2015
    我错了,我在insert tmpTable中通过Union多次查询调用了另外一个临时表。把union 改成insert into执行多次插入操作,问题解决了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2817 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:53 · PVG 21:53 · LAX 06:53 · JFK 09:53
    ♥ Do have faith in what you're doing.