Executesa prepared SQL statement.
概要
EXECUTE name [(parameter [,...])]
描述
EXECUTE用于执行_个事先准备好的声明。因为准备的语句仅存在会话的持续时间,必须是由在当前会话中较早执行的PREPARE语句创建的准备好的语句。
如果创建该语句的PREPARE语句中指定的_些参数,_组兼容的参数都必须传递给EXECUTE语句,否则将引发_个错误。注意,(不像函数)制备语句不超载基于其参数的类型或数目;准备好的语句的名字必须是_个数据库会话中是唯一的。
有关创建和准备语句用法的详细信息,请参阅准备。
参数
name
The name of the preparedstatement to execute. parameter
Theactual value of a parameter to the prepared statement. This must be an expressionyielding a value that is compatible with the data type of this parameter, aswas determined when the prepared statement was created.
示例
Createa prepared statement for an insert statement, and thenexecute it:
PREPARE fooplan (int, text, bool,numeric) AS INSERT INTO foo VALUES($1, $2, $3, $4);
EXECUTE fooplan(1,'Hunter Valley', 't', 200.00);
兼容性
TheSQL standard includes an execute statement, but it isonly for use in embedded SQL. This version of the executestatementalso uses a somewhat different syntax.
相关参考