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

12 lines
365 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`solunionCAP_afterInsert`
AFTER INSERT ON `solunionCAP`
FOR EACH ROW
BEGIN
UPDATE client c
JOIN creditClassification cc ON cc.client = c.id
JOIN creditInsurance ci ON ci.creditClassification = cc.id
SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance;
END$$
DELIMITER ;