14 lines
381 B
MySQL
14 lines
381 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelfFk 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 = vSelfFk;
|
||
|
END$$
|
||
|
DELIMITER ;
|