salix/db/routines/vn/procedures/entry_checkPackaging.sql

21 lines
499 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_checkPackaging`(vEntryFk INT)
BEGIN
/**
* Comprueba que los campos package y packaging no sean nulos
*
* @param vEntryFk Id de entrada
*/
DECLARE vpackageOrPackingNull INT;
SELECT count(*) INTO vpackageOrPackingNull
FROM buy b
WHERE b.entryFk = vEntryFk
AND (b.packing IS NULL OR b.packagingFk IS NULL);
IF vpackageOrPackingNull THEN
CALL util.throw("packageOrPackingNull");
END IF;
END$$
DELIMITER ;