27 lines
530 B
SQL
27 lines
530 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_riskAll`()
|
|
BEGIN
|
|
/**
|
|
* Update the risk for all clients with pending tickets
|
|
*
|
|
*/
|
|
DECLARE vDone BOOL;
|
|
DECLARE vClientFk INT;
|
|
|
|
DECLARE cClients CURSOR FOR
|
|
SELECT id
|
|
FROM client;
|
|
|
|
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
|
SET vDone = TRUE;
|
|
|
|
OPEN cClients;
|
|
myLoop: LOOP
|
|
SET vDone = FALSE;
|
|
FETCH cClients INTO vClientFk;
|
|
IF vDone THEN LEAVE myLoop; END IF;
|
|
CALL client_risk(vClientFk);
|
|
END LOOP;
|
|
CLOSE cClients;
|
|
END$$
|
|
DELIMITER ; |