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; INSERT into aaaa VALUES(2,3); INSERT into aaaaa VALUES(2,3); IF t_error = 1 THEN ROLLBACK; ELSE COMMIT; END IF; END