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

22 lines
460 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`buy_getVolume`(vSelf INT)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Calculates the volume occupied by a buy.
*
* @param vSelf The buy id
* @return The volume in cubic centimeters
*/
DECLARE vItem INT;
DECLARE vPackaging VARCHAR(10);
SELECT itemFk, packagingFk INTO vItem, vPackaging
FROM buy
WHERE id = vSelf;
RETURN item_getVolume(vItem, vPackaging);
END$$
DELIMITER ;