2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11))
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Comprueba si la impresora pertenece al sector
|
|
|
|
*
|
|
|
|
* @param vLabelerFk id de la impresora
|
|
|
|
* @param vSector sector a comprobar
|
|
|
|
*/
|
|
|
|
DECLARE isPrinterInNewSector BOOL;
|
|
|
|
|
|
|
|
IF vLabelerFk IS NOT NULL THEN
|
|
|
|
SELECT COUNT(sectorFK) INTO isPrinterInNewSector
|
|
|
|
FROM vn.printer p
|
|
|
|
WHERE id = vLabelerFk AND sectorFk = vSector;
|
|
|
|
|
|
|
|
IF !isPrinterInNewSector THEN
|
|
|
|
CALL util.throw("PrinterNotInSameSector");
|
|
|
|
END IF;
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|