mysql通用分页存储过程

创建存储过程:
CREATE  PROCEDURE '存储过程名'
(_field varchar(400),
_table varchar(50),
_whe varchar(200),
_begin int,
_amount int)
BEGIN
declare sSql   varchar(4000);
set sSql=concat('select ',_field,' from ',_table,' where ',_whe,' limit ',_begin,',',_amount);
set @qstr=sSql;
prepare stmt from @qstr;
execute stmt;
END
调用方法:
call IOS_Table_DataPaging('branch_bank_code,branch_bank_name','ios_branch_bank_db','id>0',0,1);
posted @ 2013-05-17 15:50  BicycleBoy  阅读(262)  评论(0编辑  收藏  举报