2024-05-02 15:05:10 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_riskAll`()
|
|
|
|
BEGIN
|
|
|
|
/**
|
2024-05-02 16:13:12 +00:00
|
|
|
* Update the risk for all clients with pending tickets
|
2024-05-02 15:05:10 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
DECLARE vDone BOOL;
|
|
|
|
DECLARE vClientFk INT;
|
|
|
|
|
|
|
|
DECLARE cClients CURSOR FOR
|
|
|
|
SELECT id
|
2024-05-02 16:13:12 +00:00
|
|
|
FROM client;
|
2024-05-02 15:05:10 +00:00
|
|
|
|
|
|
|
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;
|
2024-05-02 16:13:12 +00:00
|
|
|
CALL client_risk(vClientFk);
|
2024-05-02 15:05:10 +00:00
|
|
|
END LOOP;
|
|
|
|
CLOSE cClients;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|