1<!-- 2doc/src/sgml/ref/call.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-call"> 7 <indexterm zone="sql-call"> 8 <primary>CALL</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>CALL</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>CALL</refname> 19 <refpurpose>invoke a procedure</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24CALL <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argument</replaceable> ] [, ...] ) 25</synopsis> 26 </refsynopsisdiv> 27 28 <refsect1> 29 <title>Description</title> 30 31 <para> 32 <command>CALL</command> executes a procedure. 33 </para> 34 35 <para> 36 If the procedure has any output parameters, then a result row will be 37 returned, containing the values of those parameters. 38 </para> 39 </refsect1> 40 41 <refsect1> 42 <title>Parameters</title> 43 44 <variablelist> 45 <varlistentry> 46 <term><replaceable class="parameter">name</replaceable></term> 47 <listitem> 48 <para> 49 The name (optionally schema-qualified) of the procedure. 50 </para> 51 </listitem> 52 </varlistentry> 53 54 <varlistentry> 55 <term><replaceable class="parameter">argument</replaceable></term> 56 <listitem> 57 <para> 58 An input argument for the procedure call. 59 See <xref linkend="sql-syntax-calling-funcs"/> for the full details on 60 function and procedure call syntax, including use of named parameters. 61 </para> 62 </listitem> 63 </varlistentry> 64 </variablelist> 65 </refsect1> 66 67 <refsect1> 68 <title>Notes</title> 69 70 <para> 71 The user must have <literal>EXECUTE</literal> privilege on the procedure in 72 order to be allowed to invoke it. 73 </para> 74 75 <para> 76 To call a function (not a procedure), use <command>SELECT</command> instead. 77 </para> 78 79 <para> 80 If <command>CALL</command> is executed in a transaction block, then the 81 called procedure cannot execute transaction control statements. 82 Transaction control statements are only allowed if <command>CALL</command> 83 is executed in its own transaction. 84 </para> 85 86 <para> 87 <application>PL/pgSQL</application> handles output parameters 88 in <command>CALL</command> commands differently; 89 see <xref linkend="plpgsql-statements-calling-procedure"/>. 90 </para> 91 </refsect1> 92 93 <refsect1> 94 <title>Examples</title> 95<programlisting> 96CALL do_db_maintenance(); 97</programlisting> 98 </refsect1> 99 100 <refsect1> 101 <title>Compatibility</title> 102 103 <para> 104 <command>CALL</command> conforms to the SQL standard. 105 </para> 106 </refsect1> 107 108 <refsect1> 109 <title>See Also</title> 110 111 <simplelist type="inline"> 112 <member><xref linkend="sql-createprocedure"/></member> 113 </simplelist> 114 </refsect1> 115</refentry> 116