create procedure test(in a int) BEGIN DECLARE t_error INTEGER DEFAULT 0; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1;-- 异常时设置为1 START TRANSACTION; -- 需要执行的sqlIF t_error = 1 THEN ROLLBACK; ELSE COMMIT; END IF; END
create procedure test(in a int) BEGIN DECLARE t_error INTEGER DEFAULT 0; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET t_error=1;-- 异常时设置为1 START TRANSACTION; -- 需要执行的sqlIF t_error = 1 THEN ROLLBACK; ELSE COMMIT; END IF; END