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

DECLARE STATEMENT

DECLARE STATEMENT <refpurpose>declare SQL statement identifier</refpurpose> — SQL文識別子を宣言する

概要

EXEC SQL [ AT connection_name ] DECLARE statement_name STATEMENT

説明

<title>Description</title>

<command>DECLARE STATEMENT</command> declares an SQL statement identifier. SQL statement identifier can be associated with the connection. When the identifier is used by dynamic SQL statements, the statements are executed using the associated connection. The namespace of the declaration is the precompile unit, and multiple declarations to the same SQL statement identifier are not allowed. Note that if the precompiler runs in Informix compatibility mode and some SQL statement is declared, "database" can not be used as a cursor name. DECLARE STATEMENTはSQL文識別子を宣言します。 SQL文識別子は接続と関連させることができます。 識別子が動的SQL文で使われれば、文は関連する接続を使って実行されます。 宣言の名前空間はプリプロセスの単位であり、同じSQL文識別子の複数回の宣言は認められていません。 プリプロセッサがInformix互換モードで動作していて、SQL文が宣言されているのなら、"database"はカーソル名として使えないことに注意してください。

パラメータ

<title>Parameters</title>
connection_name #

A database connection name established by the <command>CONNECT</command> command. CONNECTコマンドにより確立されたデータベース接続名。

AT clause can be omitted, but such statement has no meaning. AT句は省略可能ですが、そのような文は意味がありません。

statement_name #

The name of an SQL statement identifier, either as an SQL identifier or a host variable. SQL文識別子の名前で、SQL識別子かホスト変数のいずれかです。

注釈

<title>Notes</title>

This association is valid only if the declaration is physically placed on top of a dynamic statement. 宣言が物理的に動的文の上に置かれた場合にのみ、この関連は有効です。

<title>Examples</title>
EXEC SQL CONNECT TO postgres AS con1;
EXEC SQL AT con1 DECLARE sql_stmt STATEMENT;
EXEC SQL DECLARE cursor_name CURSOR FOR sql_stmt;
EXEC SQL PREPARE sql_stmt FROM :dyn_string;
EXEC SQL OPEN cursor_name;
EXEC SQL FETCH cursor_name INTO :column1;
EXEC SQL CLOSE cursor_name;

互換性

<title>Compatibility</title>

<command>DECLARE STATEMENT</command> is an extension of the SQL standard, but can be used in famous DBMSs. DECLARE STATEMENTは標準SQLの拡張ですが、有名なDBMSは利用できます。

関連項目

<title>See Also</title> CONNECT, DECLARE, OPEN