DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2)) BEGIN /** * Actualiza la columna balance de worker. * * @param selfFk, credit, debit */ UPDATE worker SET balance = IFNULL(balance, 0) + IFNULL(vCredit, 0) - IFNULL(vDebit, 0) WHERE id = vSelf; END$$ DELIMITER ;