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