salix/db/routines/vn/triggers/cmr_beforeDelete.sql

11 lines
329 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`cmr_beforeDelete`
BEFORE DELETE ON `cmr`
FOR EACH ROW
BEGIN
IF NOT (OLD.companyFk <=> NULL AND OLD.addressFromFk <=> NULL AND OLD.packagesList <=> NULL) THEN
CALL util.throw("Can not delete cmr, fields required not empty");
END IF;
END$$
DELIMITER ;