salix/db/routines/vn/procedures/workerForAllCalculateBoss.sql

34 lines
592 B
MySQL
Raw Permalink Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`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 ;