salix/db/routines/vn/functions/ticket_getWeight.sql

23 lines
399 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`ticket_getWeight`(vTicketFk INT)
RETURNS decimal(10,3)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Devuelve el peso total del ticket
*
* @return Total peso
*/
DECLARE vWeight DECIMAL(10,3);
SELECT sum(weight) INTO vWeight
FROM saleVolume
WHERE ticketFk = vTicketFk;
RETURN vWeight;
END$$
DELIMITER ;