mysql v 5.0.22
CREATE PROCEDURE `p1`(in param integer)
begin
declare var1 varchar(20);
if param = 1 then
set @var1 = 'qq520';
else
set @var1 = 'wunder';
end if;
set @sqlstr ='select * from _userinfo where uname like ?';
prepare stmt from @sqlstr;
EXECUTE stmt USING @var1;
end;
接收参数,如果是int类型的1,则like qq520 反之like wunder