1 Create PROCEDURE getuser 2 ( 3 IN pageIndex INT, 4 IN pageSize INT, 5 OUT count INT 6 ) 7 8 BEGIN 9 declare pindex int DEFAULT (pageIndex-1)*pageSize; 10 11 select * from lc_user order by id LImit pindex,pageSize; 12 13 SELECT COUNT(id) INTO count from lc_user; 14 15 END
调用:
1 CALL getuser(1,10,@count);
2 select @count;
结果集: