23 lines
401 B
MySQL
23 lines
401 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`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 ;
|