バージョンごとのドキュメント一覧

CALL

CALL <refpurpose>invoke a procedure</refpurpose> — プロシージャを呼び出す

概要

CALL name ( [ argument ] [, ...] )

説明

<title>Description</title>

<command>CALL</command> executes a procedure. CALLは、プロシージャを実行します。

If the procedure has any output parameters, then a result row will be returned, containing the values of those parameters. プロシージャがいくつかの出力パラメータを持っている場合、それらの出力パラメータの値を含んだ結果の行を返します。

パラメータ

<title>Parameters</title>
name

The name (optionally schema-qualified) of the procedure. プロシージャの名前です(スキーマ修飾名も可)。

argument

An argument expression for the procedure call. プロシージャの呼び出しに対する引数式です。

Arguments can include parameter names, using the syntax <literal><replaceable class="parameter">name</replaceable> =&gt; <replaceable class="parameter">value</replaceable></literal>. This works the same as in ordinary function calls; see <xref linkend="sql-syntax-calling-funcs"/> for details. 引数は、name => valueという構文を使ってパラメータ名を含むことができます。 これは通常の関数呼び出しと同様に動作します。詳細は4.3を参照してください。

Arguments must be supplied for all procedure parameters that lack defaults, including <literal>OUT</literal> parameters. However, arguments matching <literal>OUT</literal> parameters are not evaluated, so it's customary to just write <literal>NULL</literal> for them. (Writing something else for an <literal>OUT</literal> parameter might cause compatibility problems with future <productname>PostgreSQL</productname> versions.) 引数は、OUTパラメータを含む、デフォルトのないプロシージャパラメータすべてに対して与えなければなりません。 しかしながら、OUTパラメータに一致する引数は評価されませんので、それらに対してはNULLとだけ書くのが慣例です。 (OUTパラメータに対して何か他のものを書くと、PostgreSQLの将来のバージョンで互換性の問題が起きるかもしれません。)

注釈

<title>Notes</title>

The user must have <literal>EXECUTE</literal> privilege on the procedure in order to be allowed to invoke it. プロシージャの呼び出しを許可されるためには、ユーザがプロシージャに対するEXECUTE権限を持つ必要があります。

To call a function (not a procedure), use <command>SELECT</command> instead. 関数(プロシージャではなく)の呼び出しには、代わりにSELECTを使用します。

If <command>CALL</command> is executed in a transaction block, then the called procedure cannot execute transaction control statements. Transaction control statements are only allowed if <command>CALL</command> is executed in its own transaction. トランザクションブロック内でCALLが実行される場合、呼び出されたプロシージャはトランザクション制御文を実行できません。 トランザクション制御文は、CALLが自身のトランザクション内で実行された場合のみ許可されます。

<application>PL/pgSQL</application> handles output parameters in <command>CALL</command> commands differently; see <xref linkend="plpgsql-statements-calling-procedure"/>. PL/pgSQLではCALLコマンド内の出力パラメータの扱いが異なります。 43.6.3を参照してください。

<title>Examples</title>
CALL do_db_maintenance();

互換性

<title>Compatibility</title>

<command>CALL</command> conforms to the SQL standard, except for the handling of output parameters. The standard says that users should write variables to receive the values of output parameters. CALLは、出力パラメータの扱いを除いて標準SQLに準拠しています。 ユーザは出力パラメータの値を受け取る変数を書くべきだと標準は述べています。

関連項目

<title>See Also</title> CREATE PROCEDURE