日期:2014-05-16  浏览次数:20666 次

存储过程,单引号问题
请教个问题,存储过程中参数,,IN stype VARCHAR(50)

我需要这样使用 where a in(stype) 它默认是 where a in ('1,2,3') 
,我现在想要 where a in (1,2,3) 。。。。各位请问这样要怎么处理啊


------解决方案--------------------
把要执行的sql拼成一个字符串,再prepare执行。
------解决方案--------------------
set @asql=concat('select ... from ... where a in(\'',type,'\')');
prepare stml from @asql;
execute stml;
------解决方案--------------------
where find_in_set(a,'1,2,3')
------解决方案--------------------
where find_in_set(a,stype)