#创建存储过程
delimiter //
drop procedure if exists looppc;
create procedure looppc(in mmm CHAR(120))
begin
declare i int; #定义变量
set i = 0; #设置变量的值
#循环条件
while i<( SELECT (length(zjxx_exampeople.seegroupid)-length(REPLACE(zjxx_exampeople.seegroupid,',',''))) FROM zjxx_exampeople )
DO
SELECT
*
FROM `zjxx_exampeople` WHERE
FIND_IN_SET(REPLACE(substring_index(zjxx_exampeople.seegroupid, ',',i+1),
CONCAT(substring_index(zjxx_exampeople.seegroupid, ',',i),','),''),mmm);
set i = i + 1;
END WHILE;
END; //
CALL looppc('2|3') #调用存储过程
创建存储过程并调用
最新推荐文章于 2023-05-19 23:30:00 发布