DELIMITER $$
DROP procedure IF EXISTS pro_report_data $$
CREATE procedure pro_report_data(in startT varchar(100),in stopT varchar(100),in buyerFilter varchar(20),gfs varchar(2000),qfs varchar(2000))
BEGIN
declare colsStr varchar(2000);
declare tableStr varchar(2000);
declare whereStr varchar(2000);
declare groupStr varchar(2000);
declare sqls varchar(2000);
call createReportSql4Other(null,null,0,buyerFilter,gfs,qfs,2,startT,stopT,0,colsStr,tableStr,whereStr,groupStr);
set sqls= concat('select ',colsStr,' from ',tableStr,' where ',whereStr,' group by ',groupStr);
set @ms=sqls;
PREPARE s1 from @ms;
EXECUTE s1;
deallocate prepare s1;
END$$
DELIMITER;
转载自:http://blog.csdn.net/liuxiao723846/article/details/47106359
MySQL存错过程动态执行sql的方式来返回结果集
最新推荐文章于 2024-07-17 16:13:20 发布