mysql如何检查临时表.
我做了个存储过程,一张临时表,但每次使用都需要删除,但删除的话就会报错(如果没有表的话),报错就没法执行了.if EXISTS 
 drop table testTable
create TEMPORARY  table testTable  select * from user where user_from = 372 and user_add_date > "2008-11-12" and user_add_date < "2009-2-12" ;
谁知道该如何处理

解决方案 »

  1.   

    drop TEMPORARY TABLE IF EXISTS tt
    create TEMPORARY  table TT  select * from user where user_from = 372 and user_add_date > "2008-11-12" and user_add_date < "2009-2-12" ;
      

  2.   

    语法格式是 DROP [TEMPORARY] TABLE [IF EXISTS]DROP TEMPORARY TABLE IF EXISTS testTable;12.1.16. DROP TABLE Syntax
    DROP [TEMPORARY] TABLE [IF EXISTS]
        tbl_name [, tbl_name] ...
        [RESTRICT | CASCADE]
    http://dev.mysql.com/doc/refman/5.1/zh/index.html