18 lines
382 B
MySQL
18 lines
382 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketTotalVolume`(vTicketId INT)
|
||
|
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 ;
|