创建存储过程并调用

来源:互联网 发布:php判断移动端和pc端 编辑:程序博客网 时间:2024/06/03 17:17
#创建存储过程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 )DOSELECT*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')  #调用存储过程

0 0
原创粉丝点击