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
时间: 2024-10-13 04:43:34