2 doc/src/sgml/ref/execute.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-execute">
7 <indexterm zone=
"sql-execute">
8 <primary>EXECUTE
</primary>
11 <indexterm zone=
"sql-execute">
12 <primary>prepared statements
</primary>
13 <secondary>executing
</secondary>
17 <refentrytitle>EXECUTE
</refentrytitle>
18 <manvolnum>7</manvolnum>
19 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
23 <refname>EXECUTE
</refname>
24 <refpurpose>execute a prepared statement
</refpurpose>
29 EXECUTE
<replaceable class=
"parameter">name
</replaceable> [ (
<replaceable class=
"parameter">parameter
</replaceable> [, ...] ) ]
34 <title>Description
</title>
37 <command>EXECUTE
</command> is used to execute a previously prepared
38 statement. Since prepared statements only exist for the duration of a
39 session, the prepared statement must have been created by a
40 <command>PREPARE
</command> statement executed earlier in the
45 If the
<command>PREPARE
</command> statement that created the statement
46 specified some parameters, a compatible set of parameters must be
47 passed to the
<command>EXECUTE
</command> statement, or else an
48 error is raised. Note that (unlike functions) prepared statements are
49 not overloaded based on the type or number of their parameters; the
50 name of a prepared statement must be unique within a database session.
54 For more information on the creation and usage of prepared statements,
55 see
<xref linkend=
"sql-prepare"/>.
60 <title>Parameters
</title>
64 <term><replaceable class=
"parameter">name
</replaceable></term>
67 The name of the prepared statement to execute.
73 <term><replaceable class=
"parameter">parameter
</replaceable></term>
76 The actual value of a parameter to the prepared statement. This
77 must be an expression yielding a value that is compatible with
78 the data type of this parameter, as was determined when the
79 prepared statement was created.
87 <title>Outputs
</title>
89 The command tag returned by
<command>EXECUTE
</command>
90 is that of the prepared statement, and not
<literal>EXECUTE
</literal>.
95 <title>Examples
</title>
97 Examples are given in
<xref linkend=
"sql-prepare-examples"/>
98 in the
<xref linkend=
"sql-prepare"/> 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"/></member>
118 <member><xref linkend=
"sql-prepare"/></member>