23 lines
601 B
SQL
23 lines
601 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`printer_checkSector`(vLabelerFk tinyint(3) unsigned, vSector INT(11))
|
|
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 ;
|