NAME
EXECUTE - 执行一个准备好的查询
SYNOPSIS
EXECUTE plan_name [ (parameter [, ...] ) ]
DESCRIPTION 描述
EXECUTE 用于执行一个前面准备好的语句。 因为一个准备好的查询只在会话的生命期里存在,那么准备好的查询必须是在当前会话的前些时候用 PREPARE 语句执行的。
如果创建语句的 PREPARE 语句声明了一些参数, 那么传递给 EXECUTE 语句的必须是一个兼容的参数集, 否则就会生成一个错误。请注意(和函数不同),准备好的语句不会基于参数的类型或者个数重载: 在一次数据库会话过程中,准备好的语句的名字必须是***的。
有关创建和使用准备好的语句的更多信息, 请参阅 PREPARE [prepare(7)].
PARAMETERS 参数
- plan_name
要执行的准备好的语句。- parameter
给准备好的语句的一个参数的具体数值。 它必须是一个生成与创建这个准备好的语句的 PREPARE 语句指定参数位置的参数相兼容的数据类型的表达式。
COMPATIBILITY 兼容性
SQL 标准包括一个 EXECUTE 语句, 但它只是用于嵌入的 SQL 客户端。PostgreSQL 实现的 EXECUTE 的语法也略微不同。
#p#
NAME
EXECUTE - execute a prepared statement
SYNOPSIS
EXECUTE plan_name [ (parameter [, ...] ) ]
DESCRIPTION
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.
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.
For more information on the creation and usage of prepared statements, see PREPARE [prepare(7)].
PARAMETERS
- plan_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 of a type compatible with the data type specified for this parameter position in the PREPARE command that created the prepared statement.
COMPATIBILITY
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.