DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerForAllCalculateBoss`()
BEGIN
/**
* Actualiza la tabla workerBosses utilizando el procedimiento
* vn.workerCalculateBoss(), actualiza todos los trabajadores en esa tabla
*
*/
	DECLARE vWorker INT;
	DECLARE vDone BOOL;

	DECLARE cur CURSOR FOR
	SELECT id FROM worker;

	DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;

	OPEN cur;

	l: LOOP
		SET vDone = FALSE;
		FETCH cur INTO vWorker;

		IF vDone THEN
			LEAVE l;
		END IF;

		CALL workerCalculateBoss(vWorker);
	END LOOP;

	CLOSE cur;

END$$
DELIMITER ;
