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

12 lines
385 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_BEFORE_DELETE`
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE vn2008.Clientes c
JOIN creditClassification cc ON c.Id_Cliente = cc.client
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END$$
DELIMITER ;