首页 > 代码库 > mysql双重循环示例
mysql双重循环示例
BEGIN DECLARE menu_id VARCHAR(36); DECLARE done INT DEFAULT FALSE; DECLARE cursor_rule CURSOR FOR SELECT s.id FROM d_menu_type s ; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN cursor_rule; l : LOOP FETCH cursor_rule INTO menu_id; IF done THEN LEAVE l; END IF; BEGIN DECLARE property_id VARCHAR(36); DECLARE done2 INT DEFAULT FALSE; DECLARE cursor_rule2 CURSOR FOR SELECT property_id FROM d_menu_property l WHERE l.menu_id=menu_id; DECLARE CONTINUE HANDLER FOR NOT FOUND SET done2 = TRUE; OPEN cursor_rule2; l2 : LOOP FETCH cursor_rule2 INTO property_id; IF done2 THEN LEAVE l2; END IF; END LOOP; CLOSE cursor_rule2; END; END LOOP; CLOSE cursor_rule; END
mysql双重循环示例
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。