diff --git a/rds_mysql/stored_procedure/crm_history.sql b/rds_mysql/stored_procedure/crm_history.sql index f361a850..7573bf9b 100644 --- a/rds_mysql/stored_procedure/crm_history.sql +++ b/rds_mysql/stored_procedure/crm_history.sql @@ -10,10 +10,13 @@ BEGIN @error_state = RETURNED_SQLSTATE, @error_msg = MESSAGE_TEXT; EXECUTE drop_tmp_table_stmt; DEALLOCATE PREPARE drop_tmp_table_stmt; + ROLLBACK; SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO = @error_state, MESSAGE_TEXT = @error_msg; END; + START TRANSACTION; + -- ②-3で利用する一時テーブル削除のSQLを準備 -- 例外処理でも利用するため先に記述 SET @drop_tmp_table = ' @@ -85,4 +88,6 @@ BEGIN EXECUTE drop_tmp_table_stmt; DEALLOCATE PREPARE drop_tmp_table_stmt; + COMMIT; + END \ No newline at end of file