It is my Computer Notes. Using Guide : object-key or object-key-key e.g. Step 1 Blog Search : [mysql-run] and then Step 2 ctrl+F [mysql-run] {bookMark me : Ctrl+D}
2015年1月27日 星期二
mysql-procedure-sum self-table-update with difference record updatePaymentLineContra
delimiter $$
drop procedure updatePaymentLineContra $$
CREATE PROCEDURE updatePaymentLineContra (
selfRecordid varchar(20))
BEGIN
declare V_contra_amount double;
declare V_contra_domain_amount double;
SELECT SUM(AMOUNT) ,SUM(DOMAIN_AMOUNT)
into V_contra_amount, V_contra_domain_amount
FROM PAYMENT_LINE
where SINV_RECORDID=selfRecordid;
update PAYMENT_LINE SET CONTRA_AMOUNT=V_contra_amount
, CONTRA_DOMAIN_AMOUNT= V_contra_domain_amount WHERE RECORDID=selfRecordid;
END;
$$
DELIMITER ;
CALL updatePaymentLineContra(1421404507881);
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言