简单存储过程 动态sql语句错误
delimiter\\
CREATE PROCEDURE TEST1
BEGIN
SET @tblName="advertisement";
set @strSQL = "select * from " + @tblName;
-- + " where " + @strWhere;
prepare stmt from @strSQL;
execute stmt;
END;
错误 :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BEGIN
SET @tblName="advertisement";
set @strSQL = "select * from " + @tblName' at line 2
delimiter\\
CREATE PROCEDURE TEST1
BEGIN
SET @tblName="advertisement";
set @strSQL = "select * from " + @tblName;
-- + " where " + @strWhere;
prepare stmt from @strSQL;
execute stmt;
END;
错误 :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BEGIN
SET @tblName="advertisement";
set @strSQL = "select * from " + @tblName' at line 2
CREATE PROCEDURE TEST1()
BEGIN
select * from advertisement;
END||
delimiter ;