head	1.17;
access;
symbols
	REL9_0_0:1.17
	REL9_1_ALPHA1:1.17
	REL9_0_RC1:1.17
	REL9_0_BETA4:1.17
	REL9_0_STABLE:1.17.0.2
	REL9_0_BETA3:1.17
	REL9_0_BETA2:1.17
	REL7_4_29:1.6
	REL8_0_25:1.12
	REL8_1_21:1.12
	REL8_2_17:1.14
	REL8_3_11:1.15
	REL8_4_4:1.16
	REL9_0_BETA1:1.17
	REL9_0_ALPHA5_BRANCH:1.16.0.12
	REL9_0_ALPHA5:1.16
	REL7_4_28:1.6
	REL8_0_24:1.12
	REL8_1_20:1.12
	REL8_2_16:1.14
	REL8_3_10:1.15
	REL8_4_3:1.16
	REL9_0_ALPHA4:1.16
	REL9_0_ALPHA4_BRANCH:1.16.0.10
	REL8_5_ALPHA3:1.16
	REL8_5_ALPHA3_BRANCH:1.16.0.8
	REL7_4_27:1.6
	REL8_0_23:1.12
	REL8_1_19:1.12
	REL8_2_15:1.14
	REL8_3_9:1.15
	REL8_4_2:1.16
	REL8_5_ALPHA2:1.16
	REL8_5_ALPHA2_BRANCH:1.16.0.6
	REL7_4_26:1.6
	REL8_0_22:1.12
	REL8_1_18:1.12
	REL8_2_14:1.14
	REL8_3_8:1.15
	REL8_4_1:1.16
	REL8_5_ALPHA1:1.16
	REL8_5_ALPHA1_BRANCH:1.16.0.4
	REL8_4_STABLE:1.16.0.2
	REL8_4_0:1.16
	REL8_4_RC2:1.16
	REL8_4_RC1:1.16
	REL8_4_BETA2:1.16
	REL8_4_BETA1:1.16
	REL7_4_25:1.6
	REL8_0_21:1.12
	REL8_1_17:1.12
	REL8_2_13:1.14
	REL8_3_7:1.15
	REL7_4_24:1.6
	REL8_0_20:1.12
	REL8_1_16:1.12
	REL8_2_12:1.14
	REL8_3_6:1.15
	REL7_4_23:1.6
	REL8_0_19:1.12
	REL8_1_15:1.12
	REL8_2_11:1.14
	REL8_3_5:1.15
	REL7_4_22:1.6
	REL8_0_18:1.12
	REL8_1_14:1.12
	REL8_2_10:1.14
	REL8_3_4:1.15
	REL7_4_21:1.6
	REL8_0_17:1.12
	REL8_1_13:1.12
	REL8_2_9:1.14
	REL8_3_3:1.15
	REL7_4_20:1.6
	REL8_0_16:1.12
	REL8_1_12:1.12
	REL8_2_8:1.14
	REL8_3_2:1.15
	REL8_2_7:1.14
	REL8_3_1:1.15
	REL8_3_STABLE:1.15.0.2
	REL8_3_0:1.15
	REL8_3_RC2:1.15
	REL7_3_21:1.1
	REL7_4_19:1.6
	REL8_0_15:1.12
	REL8_1_11:1.12
	REL8_2_6:1.14
	REL8_3_RC1:1.15
	REL8_3_BETA4:1.15
	REL8_3_BETA3:1.15
	REL8_3_BETA2:1.15
	REL8_3_BETA1:1.15
	REL7_3_20:1.1
	REL7_4_18:1.6
	REL8_0_14:1.12
	REL8_1_10:1.12
	REL8_2_5:1.14
	REL7_3_19:1.1
	REL7_4_17:1.6
	REL8_0_13:1.12
	REL8_1_9:1.12
	REL8_2_4:1.14
	REL8_0_12:1.12
	REL8_1_8:1.12
	REL8_2_3:1.14
	REL7_3_18:1.1
	REL7_4_16:1.6
	REL8_0_11:1.12
	REL8_1_7:1.12
	REL8_2_2:1.14
	REL8_0_10:1.12
	REL8_1_6:1.12
	REL8_2_1:1.14
	REL7_4_15:1.6
	REL7_3_17:1.1
	REL8_2_STABLE:1.14.0.2
	REL8_2_0:1.14
	REL8_2_RC1:1.14
	REL8_2_BETA3:1.14
	REL8_2_BETA2:1.14
	REL8_1_5:1.12
	REL8_0_9:1.12
	REL7_4_14:1.6
	REL7_3_16:1.1
	REL8_2_BETA1:1.14
	REL7_3_15:1.1
	REL7_4_13:1.6
	REL8_0_8:1.12
	REL8_1_4:1.12
	REL7_3_14:1.1
	REL7_4_12:1.6
	REL8_0_7:1.12
	REL8_1_3:1.12
	REL7_3_13:1.1
	REL7_4_11:1.6
	REL8_0_6:1.12
	REL8_1_2:1.12
	REL7_3_12:1.1
	REL7_4_10:1.6
	REL8_0_5:1.12
	REL8_1_1:1.12
	REL8_1_STABLE:1.12.0.6
	REL8_1_0:1.12
	REL8_1_0RC1:1.12
	REL8_1_0BETA4:1.12
	REL8_1_0BETA3:1.12
	REL7_3_11:1.1
	REL7_4_9:1.6
	REL8_0_4:1.12
	REL8_1_0BETA2:1.12
	REL8_1_0BETA1:1.12
	REL7_3_10:1.1
	REL7_4_8:1.6
	REL8_0_3:1.12
	REL8_0_2:1.12
	REL7_3_9:1.1
	REL7_4_7:1.6
	REL8_0_1:1.12
	REL8_0_STABLE:1.12.0.4
	REL8_0_0:1.12.0.2
	REL8_0_0RC5:1.12
	REL8_0_0RC4:1.12
	REL8_0_0RC3:1.12
	REL8_0_0RC2:1.12
	REL8_0_0RC1:1.12
	REL8_0_0BETA5:1.12
	REL8_0_0BETA4:1.12
	REL7_4_6:1.6
	REL7_3_8:1.1
	REL8_0_0BETA3:1.11
	REL8_0_0BETA2:1.10
	REL7_4_5:1.6
	REL7_3_7:1.1
	REL7_4_4:1.6
	REL8_0_0BETA1:1.10
	REL7_4_3:1.6
	REL7_4_2:1.6
	REL7_3_6:1.1
	REL7_4_1:1.6
	REL7_3_5:1.1
	REL7_4:1.6
	REL7_4_RC2:1.6
	REL7_4_STABLE:1.6.0.2
	REL7_4_RC1:1.6
	REL7_4_BETA5:1.6
	REL7_4_BETA4:1.6
	REL7_4_BETA3:1.6
	REL7_4_BETA2:1.5
	WIN32_DEV:1.5.0.2
	REL7_4_BETA1:1.5
	REL7_3_4:1.1
	REL7_3_2:1.1
	REL7_3_STABLE:1.1.0.2;
locks; strict;
comment	@# @;


1.17
date	2010.04.03.07.23.01;	author petere;	state Exp;
branches;
next	1.16;

1.16
date	2008.11.14.10.22.47;	author petere;	state Exp;
branches;
next	1.15;

1.15
date	2007.05.15.19.13.55;	author neilc;	state Exp;
branches;
next	1.14;

1.14
date	2006.09.16.00.30.18;	author momjian;	state Exp;
branches;
next	1.13;

1.13
date	2006.01.15.22.18.46;	author neilc;	state Exp;
branches;
next	1.12;

1.12
date	2004.09.30.04.23.27;	author neilc;	state Exp;
branches;
next	1.11;

1.11
date	2004.09.20.00.04.19;	author neilc;	state Exp;
branches;
next	1.10;

1.10
date	2004.04.22.11.46.22;	author tgl;	state Exp;
branches;
next	1.9;

1.9
date	2004.04.22.04.18.41;	author momjian;	state Exp;
branches;
next	1.8;

1.8
date	2004.01.26.17.26.30;	author neilc;	state Exp;
branches;
next	1.7;

1.7
date	2003.11.29.19.51.38;	author pgsql;	state Exp;
branches;
next	1.6;

1.6
date	2003.08.31.17.32.23;	author petere;	state Exp;
branches;
next	1.5;

1.5
date	2003.07.01.00.04.31;	author petere;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2003.04.26.23.56.51;	author petere;	state Exp;
branches;
next	1.3;

1.3
date	2003.02.02.23.46.37;	author tgl;	state Exp;
branches;
next	1.2;

1.2
date	2003.01.19.00.13.29;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	2002.08.27.04.55.07;	author tgl;	state Exp;
branches;
next	;

1.5.2.1
date	2003.09.07.04.36.45;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.17
log
@Remove unnecessary xref endterm attributes and title ids

The endterm attribute is mainly useful when the toolchain does not support
automatic link target text generation for a particular situation.  In  the
past, this was required by the man page tools for all reference page links,
but that is no longer the case, and it now actually gets in the way of
proper automatic link text generation.  The only remaining use cases are
currently xrefs to refsects.
@
text
@<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/execute.sgml,v 1.16 2008/11/14 10:22:47 petere Exp $
PostgreSQL documentation
-->

<refentry id="SQL-EXECUTE">
 <refmeta>
  <refentrytitle>EXECUTE</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>EXECUTE</refname>
  <refpurpose>execute a prepared statement</refpurpose>
 </refnamediv>

 <indexterm zone="sql-execute">
  <primary>EXECUTE</primary>
 </indexterm>

 <indexterm zone="sql-execute">
  <primary>prepared statements</primary>
  <secondary>executing</secondary>
 </indexterm>

 <refsynopsisdiv>
<synopsis>
EXECUTE <replaceable class="PARAMETER">name</replaceable> [ ( <replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ]
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>EXECUTE</command> 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
   <command>PREPARE</command> statement executed earlier in the
   current session.
  </para>

  <para>
   If the <command>PREPARE</command> statement that created the statement
   specified some parameters, a compatible set of parameters must be
   passed to the <command>EXECUTE</command> 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.
  </para>

  <para>
   For more information on the creation and usage of prepared statements,
   see <xref linkend="sql-prepare">.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="PARAMETER">name</replaceable></term>
    <listitem>
     <para>
      The name of the prepared statement to execute.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="PARAMETER">parameter</replaceable></term>
    <listitem>
     <para>
      The actual value of a parameter to the prepared statement.  This
      must be an expression yielding a value that is compatible with
      the data type of this parameter, as was determined when the
      prepared statement was created.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Outputs</title>
   <para>
   The command tag returned by <command>EXECUTE</command>
   is that of the prepared statement, and not <literal>EXECUTE</>.
  </para>
 </refsect1>

 <refsect1>
  <title>Examples</>
  <para>
    Examples are given in the <xref linkend="sql-prepare-examples"
    endterm="sql-prepare-examples-title"> section of the <xref
    linkend="sql-prepare"> documentation.
   </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   The SQL standard includes an <command>EXECUTE</command> statement,
   but it is only for use in embedded SQL.  This version of the
   <command>EXECUTE</command> statement also uses a somewhat different
   syntax.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-deallocate"></member>
   <member><xref linkend="sql-prepare"></member>
  </simplelist>
 </refsect1>
</refentry>
@


1.16
log
@Set SQL man pages to be section 7 by default, and only transform them to
another section if required by the platform (instead of the old way of
building them in section "l" and always transforming them to the
platform-specific section).

This speeds up the installation on common platforms, and it avoids some
funny business with the man page tools and build process.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/execute.sgml,v 1.15 2007/05/15 19:13:55 neilc Exp $
d8 1
a8 1
  <refentrytitle id="sql-execute-title">EXECUTE</refentrytitle>
d55 1
a55 1
   see <xref linkend="sql-prepare" endterm="sql-prepare-title">.
d99 1
a99 1
    linkend="sql-prepare" endterm="sql-prepare-title"> documentation.
d118 2
a119 2
   <member><xref linkend="sql-deallocate" endterm="sql-deallocate-title"></member>
   <member><xref linkend="sql-prepare" endterm="sql-prepare-title"></member>
@


1.15
log
@Various fixes for the SGML docs. Consistently use spaces before/after
parentheses in syntax descriptions. Consistently use the present tense
when describing the basic purpose of each "DROP" command. Add a few
more hyperlinks.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/execute.sgml,v 1.14 2006/09/16 00:30:18 momjian Exp $
d9 1
@


1.14
log
@Remove emacs info from footer of SGML files.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/execute.sgml,v 1.13 2006/01/15 22:18:46 neilc Exp $
d28 1
a28 1
EXECUTE <replaceable class="PARAMETER">name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ]
@


1.13
log
@Allow the types of parameters to PREPARE to be inferred. If a parameter's
data type is unspecified or is declared to be "unknown", the type will
be inferred from the context in which the parameter is used. This was
already possible for protocol-level prepared statements.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/execute.sgml,v 1.12 2004/09/30 04:23:27 neilc Exp $
a121 17

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
@


1.12
log
@Add more index entries for reference pages related to prepare queries.
From Alvaro Herrera, editorializing by Neil Conway.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.11 2004/09/20 00:04:19 neilc Exp $
d28 1
a28 1
EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ]
d63 1
a63 1
    <term><replaceable class="PARAMETER">plan_name</replaceable></term>
d76 3
a78 4
      must be an expression yielding a value of a type compatible with
      the data type specified for this parameter position in the
      <command>PREPARE</command> command that created the prepared
      statement.
@


1.11
log
@Minor documentation cleanup and improvement.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.10 2004/04/22 11:46:22 tgl Exp $
d21 5
@


1.10
log
@Put information about tag in Outputs section, where it belongs.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.9 2004/04/22 04:18:41 momjian Exp $
d108 9
@


1.9
log
@Update EXECUTE docs to mention tag matches prepared statement.

Update log_statement to more clearly state it doesn't filter based on
the statement type of the prepared statement.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.8 2004/01/26 17:26:30 neilc Exp $
a47 2
   The command tag returned by <command>EXECUTE</command>
   is that of the prepared statement, and not <literal>EXECUTE</>.
d82 8
d91 1
a91 1
   <para>
@


1.8
log
@Add usage examples for PREPARE and EXECUTE. Original patch from Gavin
Sherry, editorializing by Neil Conway.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.7 2003/11/29 19:51:38 pgsql Exp $
d48 2
@


1.7
log
@
$Header: -> $PostgreSQL Changes ...
@
text
@d2 1
a2 1
$PostgreSQL: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.6 2003/08/31 17:32:23 petere Exp $
d79 9
@


1.6
log
@Add/edit index entries.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.5 2003/07/01 00:04:31 petere Exp $
@


1.5
log
@Change EXECUTE INTO to CREATE TABLE AS EXECUTE.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.4 2003/04/26 23:56:51 petere Exp $
d16 4
@


1.5.2.1
log
@Update this branch to match CVS head, includes WIN32 improvements.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.6 2003/08/31 17:32:23 petere Exp $
a15 4

 <indexterm zone="sql-execute">
  <primary>EXECUTE</primary>
 </indexterm>
@


1.4
log
@Editing of more reference pages.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.3 2003/02/02 23:46:37 tgl Exp $
d19 1
a19 1
EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] [ INTO [ TEMPORARY | TEMP ] <replaceable class="PARAMETER">table</replaceable> ]
a43 7
   Like <command>SELECT INTO</command>, <command>EXECUTE</command> can
   store the results of executing a query into a newly-created
   table, by specifying an <literal>INTO</> clause. For more information on this behavior,
   see <xref linkend="sql-selectinto" endterm="sql-selectinto-title">.
  </para>

  <para>
a70 12
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="PARAMETER">table</replaceable></term>
    <listitem>
     <para>
      The name of the table in which to store the results of executing
      the statement (if it is a <command>SELECT</command>). If no
      table is specified, the results are returned to the client (as
      normal).
@


1.3
log
@Implement EXPLAIN EXECUTE.  By Neil Conway, with some kibitzing from
Tom Lane.
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.2 2003/01/19 00:13:29 momjian Exp $
d11 1
d13 2
a14 6
  <refname>
   EXECUTE
  </refname>
  <refpurpose>
   execute a prepared query
  </refpurpose>
d16 1
d18 3
a20 53
  <refsynopsisdivinfo>
   <date>2002-08-12</date>
  </refsynopsisdivinfo>
  <synopsis>
   EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ] [ INTO [ TEMPORARY | TEMP ] <replaceable class="PARAMETER">table</replaceable> ]
  </synopsis>

  <refsect2 id="R2-SQL-EXECUTE-1">
   <refsect2info>
    <date>2002-08-12</date>
   </refsect2info>
   <title>
    Inputs
   </title>

   <para>
    <variablelist>
     <varlistentry>
      <term><replaceable class="PARAMETER">plan_name</replaceable></term>
      <listitem>
       <para>
		The name of the prepared query to execute.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="PARAMETER">parameter</replaceable></term>
      <listitem>
       <para>
		The actual value of a parameter to the prepared query.  This
		must be an expression yielding a value of a type compatible
		with the data-type specified for this parameter position in
		the <command>PREPARE</command> statement that created the
		prepared query.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><replaceable class="PARAMETER">table</replaceable></term>
      <listitem>
       <para>
        The name of the table in which to store the results of
        executing the query (if it is a <command>SELECT</command>). If
        no table is specified, the results are returned to the client
        (as normal).
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>
d23 2
a24 7
 <refsect1 id="R1-SQL-EXECUTE-1">
  <refsect1info>
   <date>2002-08-12</date>
  </refsect1info>
  <title>
   Description
  </title>
d28 2
a29 2
   query. Since prepared queries only exist for the duration of a
   session, the prepared query must have been created by a
d35 1
a35 1
   If the <command>PREPARE</command> statement that created the query
d38 3
a40 3
   error is raised. Note that (unlike functions) prepared queries are
   not overloaded based on the type or number of their parameters: the
   name of a prepared query must be unique within a database session.
d45 2
a46 2
   store the results of executing the query into a newly-created
   table, by specifying an INTO clause. For more information on this behavior,
d51 1
a51 1
   For more information on the creation and usage of prepared queries,
d56 49
a104 20
 <refsect1 id="R1-SQL-EXECUTE-2">
  <title>
   Compatibility
  </title>

  <refsect2 id="R2-SQL-EXECUTE-2">
   <refsect2info>
    <date>2002-08-12</date>
   </refsect2info>
   <title>
    SQL92
   </title>
   <para>
	SQL92 includes an <command>EXECUTE</command> statement, but it is
    only for use in embedded SQL clients. The
    <command>EXECUTE</command> statement implemented by
    <productname>PostgreSQL</productname> also uses a somewhat
    different syntax.
   </para>
  </refsect2>
@


1.2
log
@This patch includes a lot of minor cleanups to the SGML documentation,
including:

- replacing all the appropriate usages of <citetitle>PostgreSQL
...</citetitle> with &cite-user;, &cite-admin;, and so on

- fix an omission in the EXECUTE documentation

- add some more text to the EXPLAIN documentation

- improve the PL/PgSQL RETURN NEXT documentation (more work to do here)

- minor markup fixes


Neil Conway
@
text
@d2 1
a2 1
$Header: /cvsroot/pgsql-server/doc/src/sgml/ref/execute.sgml,v 1.1 2002/08/27 04:55:07 tgl Exp $
d102 3
a104 3
   be used to store the results of executing the query in a table by
   specifying an INTO clause. For more information on this behabior,
   consult the reference for <xref linkend="sql-selectinto">.
@


1.1
log
@PREPARE/EXECUTE statements.  Patch by Neil Conway, some kibitzing
from Tom Lane.
@
text
@d2 1
a2 1
$Header$
d24 1
a24 1
   EXECUTE <replaceable class="PARAMETER">plan_name</replaceable> [ (<replaceable class="PARAMETER">parameter</replaceable> [, ...] ) ]
d45 1
d50 17
a66 6
		The actual value of a parameter to the prepared query.
		This must be an expression yielding a value of a type
		compatible with
		the data-type specified for this parameter position in the
		<command>PREPARE</command> statement that created the prepared
		query.
d98 7
@
