DELIMETER$$ CREATE PROCEDURE actualiza_provincias() BEGIN DECLARE v_finished INTEGER DEFAULT 0; DECLARE _id, _new_id INTEGER ; DEClARE prov_cursor CURSOR FOR SELECT id_provincia, new_id FROM provincias; DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_finished = 1; OPEN prov_cursor; get_prov: LOOP FETCH prov_cursor INTO _id, _new_id; IF v_finished = 1 THEN LEAVE get_prov; END IF; // el update o lo que sea END LOOP get_prov; CLOSE prov_cursor; END$$ DELIMETER;
0 Comentarios.