1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>EXECUTE</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="sql-commands.html" title="SQL Commands">
<link rel="prev" href="sql-end.html" title="END">
<link rel="next" href="sql-explain.html" title="EXPLAIN">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="sql-execute"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>EXECUTE — execute a prepared statement</p>
</div>
<a name="id773910"></a><a name="id773919"></a><div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">EXECUTE <em class="replaceable"><code>plan_name</code></em> [ (<em class="replaceable"><code>parameter</code></em> [, ...] ) ]</pre>
</div>
<div class="refsect1" lang="en">
<a name="id773952"></a><h2>Description</h2>
<p> <code class="command">EXECUTE</code> 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
<code class="command">PREPARE</code> statement executed earlier in the
current session.
</p>
<p> If the <code class="command">PREPARE</code> statement that created the statement
specified some parameters, a compatible set of parameters must be
passed to the <code class="command">EXECUTE</code> 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.
</p>
<p> For more information on the creation and usage of prepared statements,
see <a href="sql-prepare.html">PREPARE</a>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id774013"></a><h2>Parameters</h2>
<div class="variablelist"><dl>
<dt><span class="term"><em class="replaceable"><code>plan_name</code></em></span></dt>
<dd><p> The name of the prepared statement to execute.
</p></dd>
<dt><span class="term"><em class="replaceable"><code>parameter</code></em></span></dt>
<dd><p> 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
<code class="command">PREPARE</code> command that created the prepared
statement.
</p></dd>
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id774053"></a><h2>Outputs</h2>
<p> The command tag returned by <code class="command">EXECUTE</code>
is that of the prepared statement, and not <code class="literal">EXECUTE</code>.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id774073"></a><h2>Examples</h2>
<p> Examples are given in the <a href="sql-prepare.html#sql-prepare-examples">Examples</a> section of the <a href="sql-prepare.html">PREPARE</a> documentation.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id774107"></a><h2>Compatibility</h2>
<p> The SQL standard includes an <code class="command">EXECUTE</code> statement,
but it is only for use in embedded SQL. This version of the
<code class="command">EXECUTE</code> statement also uses a somewhat different
syntax.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id774129"></a><h2>See Also</h2>
<span class="simplelist"><a href="sql-deallocate.html">DEALLOCATE</a>, <a href="sql-prepare.html">PREPARE</a></span>
</div>
</div></body>
</html>
|