1 DECLARE t_error INTEGER DEFAULT 0; 2 DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1; 3 START TRANSACTION;
7 delete from client; 8 IF t_error = 1 THEN 9 ROLLBACK; 10 ELSE 11 COMMIT; 12 END IF;
事务关键代码。
调用存储过程:Call 存储过程名字;
1 DECLARE t_error INTEGER DEFAULT 0; 2 DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1; 3 START TRANSACTION;
7 delete from client; 8 IF t_error = 1 THEN 9 ROLLBACK; 10 ELSE 11 COMMIT; 12 END IF;
事务关键代码。
调用存储过程:Call 存储过程名字;