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

12 lines
372 B
MySQL
Raw Normal View History

DELIMITER $$
2024-01-25 16:33:54 +00:00
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`solunionCAP_beforeDelete`
BEFORE DELETE ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.clientFk
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance;
END$$
DELIMITER ;