DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_riskAll`()
BEGIN
/**
 * Actualiza el riesgo todos los clientes
 *
 */
	DECLARE vDone BOOL;
	DECLARE vClientFk INT;

	DECLARE cClients CURSOR FOR 
		SELECT id 
			FROM vn.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 vn.client_risk(vClientFk);
	END LOOP;
	CLOSE cClients;
END$$
DELIMITER ;