2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-09 08:09:00 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`route_updateM3`(
|
|
|
|
vSelf INT
|
|
|
|
)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
2024-07-09 08:09:00 +00:00
|
|
|
/**
|
|
|
|
* Actualiza el volumen de la ruta.
|
|
|
|
*
|
|
|
|
* @param vSelf Id ruta
|
|
|
|
*/
|
|
|
|
CREATE OR REPLACE TEMPORARY TABLE tRouteVolume
|
|
|
|
ENGINE = MEMORY
|
|
|
|
SELECT IFNULL(SUM(volume), 0) volume
|
|
|
|
FROM saleVolume
|
|
|
|
WHERE routeFk = vSelf;
|
|
|
|
|
|
|
|
UPDATE `route`
|
|
|
|
SET m3 = (SELECT volume FROM tRouteVolume)
|
|
|
|
WHERE id = vSelf;
|
|
|
|
|
|
|
|
DROP TEMPORARY TABLE tRouteVolume;
|
2024-01-15 11:31:03 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|