mysql中,手动提交事务

1: 在mysql中,手动提交事务的案例:
CREATE PROCEDURE tfer_funds   
    (from_account int, to_account int, tfer_amount numeric(10,2))   
BEGIN   
    SET autocommit=0;   
  
    UPDATE account_balance SET balance=balance-tfer_amount WHERE account_id=from_account;   
  
    UPDATE account_balance SET balance=balance+tfer_amount WHERE account_id=to_account;   
  
    COMMIT;   
END;  
上面就使用了commit

2.要是设置为手动提交: 

在命令行中输入set  autocommit = 0 
但是,一旦重新启动mysql,mysql又默认的autocommit=1;

原文地址:https://www.cnblogs.com/maohuidong/p/11091154.html