从动态查询插入表到MYSQL无法正常工作?

时间:2018-12-07 11:36:49

标签: mysql dynamic

我需要从动态查询插入表中。我尝试使用Prepare and Execute语句,但是它不起作用。请帮助我做错的地方。

SET v_SQL = 'Select * from Patient';
DROP TEMPORARY TABLE IF EXISTS AlcoholTable;
CREATE TEMPORARY TABLE  AlcoholTable ( PatientId int ,MRNNo varchar(500),Gender varchar(500))        
Insert into  AlcoholTable
SET stmt_str = v_SQL;
PREPARE stmt FROM  stmt_str;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

0 个答案:

没有答案