2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`ticketTotalVolume`(vTicketId INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS decimal(10,3)
|
|
|
|
NOT DETERMINISTIC
|
|
|
|
READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
-- Devuelte el volumen total del ticket sumado
|
|
|
|
|
|
|
|
DECLARE vVolume DECIMAL(10,3);
|
|
|
|
|
|
|
|
SELECT SUM(volume) INTO vVolume
|
|
|
|
FROM saleVolume
|
|
|
|
WHERE ticketFk = vTicketId;
|
|
|
|
RETURN vVolume;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|