如何在mysql中选择之前确认表存在

时间:2014-01-10 07:54:19

标签: mysql sql

我需要在select操作之前确认该表存在于db中。

这是我的代码,

 set @table_name_count = CONCAT('SELECT COUNT(*) into @xcount  FROM '  , table_name, ' where issueNumber=','30030',' and ISSNcode=','112640402');
     select 'hellooo3' from dual; 
     PREPARE statement from @table_name_count;
     EXECUTE statement;
     DEALLOCATE PREPARE statement;
     select 'hello4' from dual;
     select @xcount AS xcount;
     IF @xcount > 0 and  THEN
       DELETE from table_name where issueNumber='30030' and ISSNcode='112640402' ;
     END IF  ;

如何在不创建表的情况下确认表存在于db中,并且需要返回boolen或某个int值来显示状态。

0 个答案:

没有答案