Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/09/2011, 07:08
tengotutto
 
Fecha de Ingreso: marzo-2011
Mensajes: 6
Antigüedad: 13 años, 2 meses
Puntos: 1
Respuesta: Varias llamadas a un sp

Lo estoy haciendo con cursores pero me devuelve el resultado del sp para el primer item del cursor:

delimiter //

CREATE PROCEDURE curdemo1(in plan int)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE b date;
DECLARE cur1 CURSOR FOR SELECT hp.fecha FROM historicosplanes hp where hp.idhistoricoplan=plan order by fecha ASC;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;

OPEN cur1;

c1_loop: LOOP
FETCH NEXT FROM cur1 INTO b;

IF done THEN
LEAVE c1_loop;
END IF;

call t_HPMes(plan, month(b), year(b));

END LOOP c1_loop;

CLOSE cur1;
END

//
delimiter ;


-------------