3 PostgreSQL documentation
6 <refentry id=
"SQL-EXECUTE">
8 <refentrytitle id=
"sql-execute-title">EXECUTE
</refentrytitle>
9 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
13 <refname>EXECUTE
</refname>
14 <refpurpose>execute a prepared statement
</refpurpose>
17 <indexterm zone=
"sql-execute">
18 <primary>EXECUTE
</primary>
21 <indexterm zone=
"sql-execute">
22 <primary>prepared statements
</primary>
23 <secondary>executing
</secondary>
28 EXECUTE
<replaceable class=
"PARAMETER">name
</replaceable> [ (
<replaceable class=
"PARAMETER">parameter
</replaceable> [, ...] ) ]
33 <title>Description
</title>
36 <command>EXECUTE
</command> is used to execute a previously prepared
37 statement. Since prepared statements only exist for the duration of a
38 session, the prepared statement must have been created by a
39 <command>PREPARE
</command> statement executed earlier in the
44 If the
<command>PREPARE
</command> statement that created the statement
45 specified some parameters, a compatible set of parameters must be
46 passed to the
<command>EXECUTE
</command> statement, or else an
47 error is raised. Note that (unlike functions) prepared statements are
48 not overloaded based on the type or number of their parameters; the
49 name of a prepared statement must be unique within a database session.
53 For more information on the creation and usage of prepared statements,
54 see
<xref linkend=
"sql-prepare" endterm=
"sql-prepare-title">.
59 <title>Parameters
</title>
63 <term><replaceable class=
"PARAMETER">name
</replaceable></term>
66 The name of the prepared statement to execute.
72 <term><replaceable class=
"PARAMETER">parameter
</replaceable></term>
75 The actual value of a parameter to the prepared statement. This
76 must be an expression yielding a value that is compatible with
77 the data type of this parameter, as was determined when the
78 prepared statement was created.
86 <title>Outputs
</title>
88 The command tag returned by
<command>EXECUTE
</command>
89 is that of the prepared statement, and not
<literal>EXECUTE<
/>.
96 Examples are given in the
<xref linkend=
"sql-prepare-examples"
97 endterm=
"sql-prepare-examples-title"> section of the
<xref
98 linkend=
"sql-prepare" endterm=
"sql-prepare-title"> documentation.
103 <title>Compatibility
</title>
106 The SQL standard includes an
<command>EXECUTE
</command> statement,
107 but it is only for use in embedded SQL. This version of the
108 <command>EXECUTE
</command> statement also uses a somewhat different
114 <title>See Also
</title>
116 <simplelist type=
"inline">
117 <member><xref linkend=
"sql-deallocate" endterm=
"sql-deallocate-title"></member>
118 <member><xref linkend=
"sql-prepare" endterm=
"sql-prepare-title"></member>