Postgresql 中文操作指南
Description
EXECUTE 用于执行先前准备好的语句。由于准备好的语句只存在于会话期间,因此必须由之前在当前会话中执行的 PREPARE 语句创建准备好的语句。
EXECUTE is used to execute a previously prepared statement. Since prepared statements only exist for the duration of a session, the prepared statement must have been created by a PREPARE statement executed earlier in the current session.
如果创建语句的 PREPARE 语句指定了一些参数,则必须将兼容的参数集传递给 EXECUTE 语句,否则会引发错误。请注意(与函数不同),准备好的语句不会基于其参数的类型或数量进行重载;准备好的语句的名称在数据库会话中必须是唯一的。
If the PREPARE statement that created the statement specified some parameters, a compatible set of parameters must be passed to the EXECUTE statement, or else an error is raised. Note that (unlike functions) prepared statements are not overloaded based on the type or number of their parameters; the name of a prepared statement must be unique within a database session.
有关创建和使用准备好的语句的更多信息,请参阅 PREPARE 。
For more information on the creation and usage of prepared statements, see PREPARE.
Parameters
-
name
-
The name of the prepared statement to execute.
-
-
parameter
-
The actual value of a parameter to the prepared statement. This must be an expression yielding a value that is compatible with the data type of this parameter, as was determined when the prepared statement was created.
-
Outputs
EXECUTE 返回的命令标记是准备好的语句的命令标记,而不是 EXECUTE 。
The command tag returned by EXECUTE is that of the prepared statement, and not EXECUTE.
Compatibility
SQL 标准包括一个 EXECUTE 语句,但它仅用于嵌入式 SQL。此版本的 EXECUTE 语句还使用一些不同的语法。
The SQL standard includes an EXECUTE statement, but it is only for use in embedded SQL. This version of the EXECUTE statement also uses a somewhat different syntax.