salix/db/changes/10140-kings/00-clientRisk_update.sql

19 lines
366 B
MySQL
Raw Normal View History

2020-01-23 11:58:38 +00:00
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2))
BEGIN
IF vAmount IS NOT NULL
THEN
INSERT INTO clientRisk
SET
clientFk = vClientId,
companyFk = vCompanyId,
amount = vAmount
ON DUPLICATE KEY UPDATE
amount = amount + VALUES(amount);
END IF;
END$$
DELIMITER ;