CREATE PROCEDURE GetUser(_id int,_limit int)
BEGIN
PREPARE s1 FROM 'SELECT * FROM User WHERE Cityid=? ORDER BY sendtime DESC LIMIT ?';
set @a=_id;
set @b=_limit;
EXECUTE s1 USING @a,@b;
DEALLOCATE PREPARE s1;
END;
注意:需要传参数的地方一定要用"?"号,第一个FRom后面的语句要用''括起。