mysql存储过程不支持动态参数解决办法
delimiter $$;
drop procedure if exists InsertValueWithWhile;
create procedure InsertValueWithWhile()
BEGIN
declare i int default 0;
while (i<610)
do
PREPARE stmt1 FROM
‘insert into ten_uar2 select reputations,a_nums from (select concat(?,”-”,?) as reputations,sum(a_num_aver) as a_nums from (select * from uar2 limit ?,?) as a) as b’;
SET @a = i+1;
SET @b = i+10;
SET @c = i;
SET @d = i+9;
EXECUTE stmt1 USING @a,@b,@c,@d;
set i=i+1;
end while;
end $$;
DELIMITER;
call InsertValueWithWhile();
本来直接用自定义参数,结果报错,红色字体为解决办法。
欢迎大家阅读《MySql存储过程不支持动态参数解决方法_mysql》,跪求各位点评,by 搞代码