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 */ DECLARE vVolume DECIMAL(10,1) DEFAULT (SELECT SUM(volume) FROM saleVolume WHERE routeFk = vSelf); UPDATE `route` SET m3 = IFNULL(vVolume, 0) WHERE id = vSelf; END$$ DELIMITER ;