mysql存储过程循环遍历某个表以及事件
BEGIN
DECLARE Done INT DEFAULT 0;
DECLARE pj_name_1 VARCHAR(30);
declare list cursor for select pj_name from code_list where pj_name like '%中信%' and pj_state=1;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET Done = 1;
open list;
FETCH NEXT FROM list INTO pj_name_1;
REPEAT
IF NOT Done THEN
..................
END IF;
FETCH NEXT FROM list INTO pj_name_1;
UNTIL Done END REPEAT;
CLOSE list;
END
以上为存储过程遍历某个表
事件:call 存储过程名字()
借鉴:https://www.cnblogs.com/zoupufa/p/5645865.html
肖cc
QQ2398506993