刚刚看了一个问题,看着是一类
==============================
drop PROCEDURE if exists `NewProc`;
CREATE PROCEDURE `NewProc`(IN `area` varchar(100))
BEGIN
#Routine body goes here...
-- select * from pra where id=area;
set @id = area;
set @sel = 'select * from mt t where t.name in (';
set @sel_2 = ')';
set @sentence = concat(@sel,@id,@sel_2); -- 连接字符串生成要执行的SQL语句
prepare stmt from @sentence; -- 预编释一下。 “stmt”预编释变量的名称,
execute stmt; -- 执行SQL语句
deallocate prepare stmt; -- 释放资源
END;
========================================
call NewProc("'集合类','线程'")
1.把sql拼接为字符串
2.参数必须以有效的SQL格式构造,如 '1','2','3'