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

19 lines
371 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`route_updateM3`(
vSelf INT
)
BEGIN
/**
* Actualiza el volumen de la ruta.
*
* @param vSelf Id ruta
*/
2024-07-18 12:27:10 +00:00
DECLARE vVolume DECIMAL(10,1)
DEFAULT (SELECT SUM(volume) FROM saleVolume WHERE routeFk = vSelf);
UPDATE `route`
2024-07-18 12:27:10 +00:00
SET m3 = IFNULL(vVolume, 0)
WHERE id = vSelf;
END$$
DELIMITER ;