H2 Database 简明教程

H2 Database - Commit

COMMIT 是 SQL 语法中用于提交事务的命令。我们可以提交特定的事务或提交当前执行的事务。

COMMIT is a command from the SQL grammar used to commit the transaction. We can either commit the specific transaction or we can commit the currently executed transaction.

Syntax

COMMIT 命令有两种不同的语法。

There are two different syntaxes for COMMIT command.

以下是要提交当前事务的提交命令的通用语法。

Following is the generic syntax for the commit command to commit the current transaction.

COMMIT [ WORK ]

以下是要提交特定事务的提交命令的通用语法。

Following is the generic syntax for the commit command to commit the specific transaction.

COMMIT TRANSACTION transactionName

Example 1

在此示例中,让我们使用以下命令提交当前事务。

In this example, let us commit the current transaction using the following command.

COMMIT

以上命令会产生以下输出。

The above command produces the following output.

Committed successfully

Example 2

在此示例中,我们将使用以下命令提交名为 tx_test 的事务。

In this example, we will commit the transaction named tx_test using the following command.

COMMIT TRANSACTION tx_test;

以上命令会产生以下输出。

The above command produces the following output.

Committed successfully