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

36.8. エラー処理 #

<title>Error Handling</title>

This section describes how you can handle exceptional conditions and warnings in an embedded SQL program. There are two nonexclusive facilities for this. 本節では、埋め込みSQLプログラムにおいて、例外条件や警告をどのように扱うことができるかについて説明します。 このために、共に使用できる2つの機能があります。

36.8.1. コールバックの設定 #

<title>Setting Callbacks</title>

One simple method to catch errors and warnings is to set a specific action to be executed whenever a particular condition occurs. In general: エラーや警告を受け取る簡単な手法の1つは、特定の条件が発生する度に特定の動作を実行するように設定することです。 一般的には以下のようになります。

EXEC SQL WHENEVER condition action;

<replaceable>condition</replaceable> can be one of the following: conditionは以下のいずれかを取ることができます。

SQLERROR #

The specified action is called whenever an error occurs during the execution of an SQL statement. SQL文の実行中にエラーが発生する度に、指定した動作が呼び出されます。

SQLWARNING #

The specified action is called whenever a warning occurs during the execution of an SQL statement. SQL文の実行中に警告が発生する度に、指定した動作が呼び出されます。

NOT FOUND #

The specified action is called whenever an SQL statement retrieves or affects zero rows. (This condition is not an error, but you might be interested in handling it specially.) SQL文が0行を受け取る、もしくは0行に影響する時、指定した動作が呼び出されます。 (この条件はエラーではありませんが、これを特別に扱いたい場合があります。)

<replaceable>action</replaceable> can be one of the following: actionは以下のいずれかを取ることができます。

CONTINUE #

This effectively means that the condition is ignored. This is the default. これは、実際のところ、その条件が無視されることを意味します。 これがデフォルトです。

GOTO label
GO TO label #

Jump to the specified label (using a C <literal>goto</literal> statement). 指定したラベルに移動します (Cのgoto文を使用します)。

SQLPRINT #

Print a message to standard error. This is useful for simple programs or during prototyping. The details of the message cannot be configured. 標準エラーにメッセージを出力します。 これは、単純なプログラムやプロトタイプ作成時に役に立ちます。 メッセージの詳細は設定できません。

STOP #

Call <literal>exit(1)</literal>, which will terminate the program. プログラムを終了させるexit(1)を呼び出します。

DO BREAK #

Execute the C statement <literal>break</literal>. This should only be used in loops or <literal>switch</literal> statements. Cのbreak文を実行します。 これはループ内、もしくはswitch文内でのみ使用しなければなりません。

DO CONTINUE #

Execute the C statement <literal>continue</literal>. This should only be used in loops statements. if executed, will cause the flow of control to return to the top of the loop. Cのcontinue文を実行します。 これはループ文の中でのみ実行すべきものです。 実行した場合、制御の流れがループの先頭に戻ります。

CALL name (args)
DO name (args) #

Call the specified C functions with the specified arguments. (This use is different from the meaning of <literal>CALL</literal> and <literal>DO</literal> in the normal PostgreSQL grammar.) 指定した引数で、指定したC関数を呼び出します。 (この使用法は通常のPostgreSQL構文でのCALLおよびDOとは意味が異なります。)

The SQL standard only provides for the actions <literal>CONTINUE</literal> and <literal>GOTO</literal> (and <literal>GO TO</literal>). 標準SQLではCONTINUEGOTO(とGO TO)のみを提供しています。

Here is an example that you might want to use in a simple program. It prints a simple message when a warning occurs and aborts the program when an error happens: 簡単なプログラムで使用してみたくなるような例を以下に示します。 警告が発生した場合に簡単なメッセージを表示し、エラーが発生した場合にプログラムを中断します。

EXEC SQL WHENEVER SQLWARNING SQLPRINT;
EXEC SQL WHENEVER SQLERROR STOP;

The statement <literal>EXEC SQL WHENEVER</literal> is a directive of the SQL preprocessor, not a C statement. The error or warning actions that it sets apply to all embedded SQL statements that appear below the point where the handler is set, unless a different action was set for the same condition between the first <literal>EXEC SQL WHENEVER</literal> and the SQL statement causing the condition, regardless of the flow of control in the C program. So neither of the two following C program excerpts will have the desired effect: EXEC SQL WHENEVER文はCの構文ではなく、SQLプリプロセッサのディレクティブです。 設定したエラーもしくは警告動作は、最初のEXEC SQL WHENEVERと条件を発生させたSQL文の間で、同一条件に異なる動作が設定されない限り、ハンドラを設定した箇所より後にある、すべての埋め込みSQL文に適用されます。 Cプログラムの制御フローは関係しません。 ですので、以下の2つのCプログラムの抜粋はどちらも望み通りの動作を行いません。

/*

 * WRONG

 * 間違い
 */
int main(int argc, char *argv[])
{
    ...
    if (verbose) {
        EXEC SQL WHENEVER SQLWARNING SQLPRINT;
    }
    ...
    EXEC SQL SELECT ...;
    ...
}

/*

 * WRONG

 * 間違い
 */
int main(int argc, char *argv[])
{
    ...
    set_error_handler();
    ...
    EXEC SQL SELECT ...;
    ...
}

static void set_error_handler(void)
{
    EXEC SQL WHENEVER SQLERROR STOP;
}

36.8.2. sqlca #

For more powerful error handling, the embedded SQL interface provides a global variable with the name <varname>sqlca</varname> (SQL communication area) that has the following structure: より強力にエラーを扱うために、埋め込みSQLインタフェースは以下の構造体を持つsqlca(SQL通信領域)という名前のグローバル変数を提供します。

struct
{
    char sqlcaid[8];
    long sqlabc;
    long sqlcode;
    struct
    {
        int sqlerrml;
        char sqlerrmc[SQLERRMC_LEN];
    } sqlerrm;
    char sqlerrp[8];
    long sqlerrd[6];
    char sqlwarn[8];
    char sqlstate[5];
} sqlca;

(In a multithreaded program, every thread automatically gets its own copy of <varname>sqlca</varname>. This works similarly to the handling of the standard C global variable <varname>errno</varname>.) (マルチスレッド化されたプログラムでは、各スレッドは自動的にsqlcaのコピーを独自に持ちます。 これは標準Cのerrnoグローバル変数の扱いと同様に動作します。)

<varname>sqlca</varname> covers both warnings and errors. If multiple warnings or errors occur during the execution of a statement, then <varname>sqlca</varname> will only contain information about the last one. sqlcaは警告とエラーの両方を対象としています。 1つのSQL文の実行時に複数の警告やエラーが発生した場合、sqlcaは最後のものに関した情報のみを含みます。

If no error occurred in the last <acronym>SQL</acronym> statement, <literal>sqlca.sqlcode</literal> will be 0 and <literal>sqlca.sqlstate</literal> will be <literal>"00000"</literal>. If a warning or error occurred, then <literal>sqlca.sqlcode</literal> will be negative and <literal>sqlca.sqlstate</literal> will be different from <literal>"00000"</literal>. A positive <literal>sqlca.sqlcode</literal> indicates a harmless condition, such as that the last query returned zero rows. <literal>sqlcode</literal> and <literal>sqlstate</literal> are two different error code schemes; details appear below. 直前のSQL文でエラーがなければ、sqlca.sqlcodeは0に、sqlca.sqlstate"00000"になります。 警告やエラーが発生した場合は、sqlca.sqlcodeは負の値に、sqlca.sqlstate"00000"以外になります。 正のsqlca.sqlcodeは、直前の問い合わせが0行を返したなどの無害な条件を示します。 sqlca.sqlcodesqlca.sqlstateは2つの異なるエラーコードスキームです。 後で詳細に説明します。

If the last SQL statement was successful, then <literal>sqlca.sqlerrd[1]</literal> contains the OID of the processed row, if applicable, and <literal>sqlca.sqlerrd[2]</literal> contains the number of processed or returned rows, if applicable to the command. 直前のSQL文が成功すると、sqlca.sqlerrd[1]は処理された行のOIDが、もしあれば、格納されます。 また、もしそのコマンドで適切ならば、sqlca.sqlerrd[2]は処理された、もしくは返された行数が格納されます。

In case of an error or warning, <literal>sqlca.sqlerrm.sqlerrmc</literal> will contain a string that describes the error. The field <literal>sqlca.sqlerrm.sqlerrml</literal> contains the length of the error message that is stored in <literal>sqlca.sqlerrm.sqlerrmc</literal> (the result of <function>strlen()</function>, not really interesting for a C programmer). Note that some messages are too long to fit in the fixed-size <literal>sqlerrmc</literal> array; they will be truncated. エラーもしくは警告の場合、sqlca.sqlerrm.sqlerrmcには、そのエラーを説明する文字列が格納されます。 sqlca.sqlerrm.sqlerrmlフィールドにはsqlca.sqlerrm.sqlerrmcに格納されたエラーメッセージ長が格納されます (strlen()の結果です。おそらくCプログラマは必要としないでしょう)。 一部のメッセージは固定長のsqlerrmc配列には長過ぎることに注意してください。 この場合は切り詰められます。

In case of a warning, <literal>sqlca.sqlwarn[2]</literal> is set to <literal>W</literal>. (In all other cases, it is set to something different from <literal>W</literal>.) If <literal>sqlca.sqlwarn[1]</literal> is set to <literal>W</literal>, then a value was truncated when it was stored in a host variable. <literal>sqlca.sqlwarn[0]</literal> is set to <literal>W</literal> if any of the other elements are set to indicate a warning. 警告の場合、sqlca.sqlwarn[2]Wに設定されます (他のすべての場合では、これはW以外の何かに設定されます)。 sqlca.sqlwarn[1]Wに設定された場合、ホスト変数に代入する際に値が切り詰められています。 他の要素が警告を示すように設定された場合、sqlca.sqlwarn[0]Wに設定されます。

The fields <structfield>sqlcaid</structfield>, <structfield>sqlabc</structfield>, <structfield>sqlerrp</structfield>, and the remaining elements of <structfield>sqlerrd</structfield> and <structfield>sqlwarn</structfield> currently contain no useful information. 今のところ、sqlcaidsqlabcsqlerrpならびにsqlerrdsqlwarnの上記以外の要素は有用な情報を持ちません。

The structure <varname>sqlca</varname> is not defined in the SQL standard, but is implemented in several other SQL database systems. The definitions are similar at the core, but if you want to write portable applications, then you should investigate the different implementations carefully. sqlcaは標準SQLでは定義されていません。 しかし、複数の他のSQLデータベースシステムで実装されています。 その定義は基本部分は似ていますが、移植性を持つアプリケーションを作成する場合は実装の違いを注意して調査しなければなりません。

Here is one example that combines the use of <literal>WHENEVER</literal> and <varname>sqlca</varname>, printing out the contents of <varname>sqlca</varname> when an error occurs. This is perhaps useful for debugging or prototyping applications, before installing a more <quote>user-friendly</quote> error handler. ここでWHENEVERsqlcaを組み合わせて使用して、エラーが発生した時にsqlcaの内容を表示する、1つの例を示します。 これはおそらく、よりユーザ向けのエラー処理を組み込む前の、アプリケーションのデバッグまたはプロトタイプで有用です。

EXEC SQL WHENEVER SQLERROR CALL print_sqlca();

void
print_sqlca()
{
    fprintf(stderr, "==== sqlca ====\n");
    fprintf(stderr, "sqlcode: %ld\n", sqlca.sqlcode);
    fprintf(stderr, "sqlerrm.sqlerrml: %d\n", sqlca.sqlerrm.sqlerrml);
    fprintf(stderr, "sqlerrm.sqlerrmc: %s\n", sqlca.sqlerrm.sqlerrmc);
    fprintf(stderr, "sqlerrd: %ld %ld %ld %ld %ld %ld\n", sqlca.sqlerrd[0],sqlca.sqlerrd[1],sqlca.sqlerrd[2],
                                                          sqlca.sqlerrd[3],sqlca.sqlerrd[4],sqlca.sqlerrd[5]);
    fprintf(stderr, "sqlwarn: %d %d %d %d %d %d %d %d\n", sqlca.sqlwarn[0], sqlca.sqlwarn[1], sqlca.sqlwarn[2],
                                                          sqlca.sqlwarn[3], sqlca.sqlwarn[4], sqlca.sqlwarn[5],
                                                          sqlca.sqlwarn[6], sqlca.sqlwarn[7]);
    fprintf(stderr, "sqlstate: %5s\n", sqlca.sqlstate);
    fprintf(stderr, "===============\n");
}

The result could look as follows (here an error due to a misspelled table name): 結果は以下のようになります(ここでのエラーはテーブル名の誤記述によるものです。)。

==== sqlca ====
sqlcode: -400
sqlerrm.sqlerrml: 49
sqlerrm.sqlerrmc: relation "pg_databasep" does not exist on line 38
sqlerrd: 0 0 0 0 0 0
sqlwarn: 0 0 0 0 0 0 0 0
sqlstate: 42P01
===============

36.8.3. SQLSTATESQLCODE #

<title><literal>SQLSTATE</literal> vs. <literal>SQLCODE</literal></title>

The fields <literal>sqlca.sqlstate</literal> and <literal>sqlca.sqlcode</literal> are two different schemes that provide error codes. Both are derived from the SQL standard, but <literal>SQLCODE</literal> has been marked deprecated in the SQL-92 edition of the standard and has been dropped in later editions. Therefore, new applications are strongly encouraged to use <literal>SQLSTATE</literal>. sqlca.sqlstatesqlca.sqlcodeはエラーコードを提供する異なる2つの機構です。 共に標準SQLから派生されたものですが、SQLCODEはSQL-92版では廃れたものとされ、以降の版から削除されました。 したがって、新規アプリケーションではSQLSTATEを使用することを強く勧めます。

<literal>SQLSTATE</literal> is a five-character array. The five characters contain digits or upper-case letters that represent codes of various error and warning conditions. <literal>SQLSTATE</literal> has a hierarchical scheme: the first two characters indicate the general class of the condition, the last three characters indicate a subclass of the general condition. A successful state is indicated by the code <literal>00000</literal>. The <literal>SQLSTATE</literal> codes are for the most part defined in the SQL standard. The <productname>PostgreSQL</productname> server natively supports <literal>SQLSTATE</literal> error codes; therefore a high degree of consistency can be achieved by using this error code scheme throughout all applications. For further information see <xref linkend="errcodes-appendix"/>. SQLSTATEは5要素の文字配列です。 この5文字は、各種のエラー条件、警告条件のコードを表現する数字、大文字から構成されます。 SQLSTATEは階層を持った機構です。 最初の2文字は条件を汎化したクラスを示し、残り3文字は汎化クラスの副クラスを示します。 成功状態は00000というコードで示されます。 SQLSTATEコードのほとんどは標準SQLで定義されています。 PostgreSQLサーバは本質的にSQLSTATEエラーコードをサポートしています。 したがって、すべてのアプリケーションでこのエラーコードを使用することで、高度な一貫性を達成することができます。 詳細については付録Aを参照してください。

<literal>SQLCODE</literal>, the deprecated error code scheme, is a simple integer. A value of 0 indicates success, a positive value indicates success with additional information, a negative value indicates an error. The SQL standard only defines the positive value +100, which indicates that the last command returned or affected zero rows, and no specific negative values. Therefore, this scheme can only achieve poor portability and does not have a hierarchical code assignment. Historically, the embedded SQL processor for <productname>PostgreSQL</productname> has assigned some specific <literal>SQLCODE</literal> values for its use, which are listed below with their numeric value and their symbolic name. Remember that these are not portable to other SQL implementations. To simplify the porting of applications to the <literal>SQLSTATE</literal> scheme, the corresponding <literal>SQLSTATE</literal> is also listed. There is, however, no one-to-one or one-to-many mapping between the two schemes (indeed it is many-to-many), so you should consult the global <literal>SQLSTATE</literal> listing in <xref linkend="errcodes-appendix"/> in each case. 廃止されたエラーコードの機構であるSQLCODEは単なる整数です。 0という値は成功を意味し、正の値は追加情報を持った成功を、負の値はエラーを示します。 標準SQLでは、直前のコマンドが0行を返す、もしくは0行に影響したことを示す+100という正の値のみを定義しています。 負の値は規定されていません。 したがって、この機構では低い移植性しか達成できず、また、コード体系も階層を持っていません。 歴史的に、PostgreSQLの埋め込みSQLプロセッサには、いくつかの特殊なSQLCODEの値が専用に割り当てられていました。 以下に、その数値とそのシンボル名の一覧を示します。 これらは他のSQL実装への移植性がないことを忘れないでください。 アプリケーションのSQLSTATE機構への移行を簡易化するために、対応するSQLSTATEも示しています。 しかし、2つのしくみの間の関係は1対1ではなく1対多です (実際は多対多です)。 ですので、場合ごとに付録Aに示したグローバルな各SQLSTATEを参照しなければなりません。

These are the assigned <literal>SQLCODE</literal> values: 以下は割り当て済みのSQLCODEです。

0 (ECPG_NO_ERROR) #

Indicates no error. (SQLSTATE 00000) エラーがないことを示す。(SQLSTATE 00000)

100 (ECPG_NOT_FOUND) #

This is a harmless condition indicating that the last command retrieved or processed zero rows, or that you are at the end of the cursor. (SQLSTATE 02000) これは、最後に実行したコマンドが取り出した、または、処理した行がゼロ行であったこと、あるいは、カーソルの最後であることを示す、害のない条件です。(SQLSTATE 02000)

When processing a cursor in a loop, you could use this code as a way to detect when to abort the loop, like this: 以下のように、カーソルをループ内で処理する時、ループを中断する時を検知する方法として、このコードを使用することができます。

while (1)
{
    EXEC SQL FETCH ... ;
    if (sqlca.sqlcode == ECPG_NOT_FOUND)
        break;
}

But <literal>WHENEVER NOT FOUND DO BREAK</literal> effectively does this internally, so there is usually no advantage in writing this out explicitly. しかし、WHENEVER NOT FOUND DO BREAKはこれを内部で効率的に行います。 このため、通常、外部で明示的に記述する利点はありません。

-12 (ECPG_OUT_OF_MEMORY) #

Indicates that your virtual memory is exhausted. The numeric value is defined as <literal>-ENOMEM</literal>. (SQLSTATE YE001) 仮想メモリ不足を示します。 この数値は-ENOMEMとして定義します。 (SQLSTATE YE001)

-200 (ECPG_UNSUPPORTED) #

Indicates the preprocessor has generated something that the library does not know about. Perhaps you are running incompatible versions of the preprocessor and the library. (SQLSTATE YE002) ライブラリが把握していない何かをプリプロセッサが生成したことを示します。 おそらく、互換性がないプリプロセッサとライブラリのバージョンを使用しています。 (SQLSTATE YE002)

-201 (ECPG_TOO_MANY_ARGUMENTS) #

This means that the command specified more host variables than the command expected. (SQLSTATE 07001 or 07002) コマンドの想定より多くのホスト変数が指定されたことを意味します。 (SQLSTATE 07001もしくは07002)

-202 (ECPG_TOO_FEW_ARGUMENTS) #

This means that the command specified fewer host variables than the command expected. (SQLSTATE 07001 or 07002) コマンドの想定よりも少ないホスト変数が指定されたことを意味します。 (SQLSTATE 07001もしくは07002)

-203 (ECPG_TOO_MANY_MATCHES) #

This means a query has returned multiple rows but the statement was only prepared to store one result row (for example, because the specified variables are not arrays). (SQLSTATE 21000) 問い合わせが複数行を返したけれども、SQL文では1つの結果の格納の準備だけしかしていなかったことを意味します (例えば、指定された変数が配列ではなかった)。 (SQLSTATE 21000)

-204 (ECPG_INT_FORMAT) #

The host variable is of type <type>int</type> and the datum in the database is of a different type and contains a value that cannot be interpreted as an <type>int</type>. The library uses <function>strtol()</function> for this conversion. (SQLSTATE 42804) ホスト変数の型がintですが、データベース内のデータ型が異なり、その値をintとして解釈させることができませんでした。 ライブラリはこの変換にstrtol()を使用します。 (SQLSTATE 42804)

-205 (ECPG_UINT_FORMAT) #

The host variable is of type <type>unsigned int</type> and the datum in the database is of a different type and contains a value that cannot be interpreted as an <type>unsigned int</type>. The library uses <function>strtoul()</function> for this conversion. (SQLSTATE 42804) ホスト変数の型がunsigned intですが、データベース内のデータ型が異なり、その値をunsigned intとして解釈させることができませんでした。 ライブラリはこの変換にstrtoul()を使用します。 (SQLSTATE 42804)

-206 (ECPG_FLOAT_FORMAT) #

The host variable is of type <type>float</type> and the datum in the database is of another type and contains a value that cannot be interpreted as a <type>float</type>. The library uses <function>strtod()</function> for this conversion. (SQLSTATE 42804) ホスト変数の型がfloatですが、データベース内のデータ型が異なり、その値をfloatとして解釈させることができませんでした。 ライブラリはこの変換にstrtod()を使用します。 (SQLSTATE 42804)

-207 (ECPG_NUMERIC_FORMAT) #

The host variable is of type <type>numeric</type> and the datum in the database is of another type and contains a value that cannot be interpreted as a <type>numeric</type> value. (SQLSTATE 42804) ホスト変数の型がnumericですが、データベース内のデータ型が異なり、その値をnumericとして解釈させることができませんでした。 (SQLSTATE 42804)

-208 (ECPG_INTERVAL_FORMAT) #

The host variable is of type <type>interval</type> and the datum in the database is of another type and contains a value that cannot be interpreted as an <type>interval</type> value. (SQLSTATE 42804) ホスト変数の型がintervalであり、データベース内のデータが他の型であり、interval値として解釈することができない値を含みます。 (SQLSTATE 42804)

-209 (ECPG_DATE_FORMAT) #

The host variable is of type <type>date</type> and the datum in the database is of another type and contains a value that cannot be interpreted as a <type>date</type> value. (SQLSTATE 42804) ホスト変数の型がdateであり、データベース内のデータが他の型であり、date値として解釈することができない値を含みます。 (SQLSTATE 42804)

-210 (ECPG_TIMESTAMP_FORMAT) #

The host variable is of type <type>timestamp</type> and the datum in the database is of another type and contains a value that cannot be interpreted as a <type>timestamp</type> value. (SQLSTATE 42804) ホスト変数の型がtimestampであり、データベース内のデータが他の型であり、timestamp値として解釈することができない値を含みます。 (SQLSTATE 42804)

-211 (ECPG_CONVERT_BOOL) #

This means the host variable is of type <type>bool</type> and the datum in the database is neither <literal>'t'</literal> nor <literal>'f'</literal>. (SQLSTATE 42804) これは、ホスト変数の型がboolですが、データベース内のデータが't'でも'f'でもなかったことを意味します。 (SQLSTATE 42804)

-212 (ECPG_EMPTY) #

The statement sent to the <productname>PostgreSQL</productname> server was empty. (This cannot normally happen in an embedded SQL program, so it might point to an internal error.) (SQLSTATE YE002) PostgreSQLサーバに送信されたSQL文が空でした (通常埋め込みSQLプログラムでは発生しません。ですので、これは内部エラーを示しているかもしれません)。 (SQLSTATE YE002)

-213 (ECPG_MISSING_INDICATOR) #

A null value was returned and no null indicator variable was supplied. (SQLSTATE 22002) NULL値が返されましたが、NULL用の指示子変数が与えられていませんでした。 (SQLSTATE 22002)

-214 (ECPG_NO_ARRAY) #

An ordinary variable was used in a place that requires an array. (SQLSTATE 42804) 配列が必要な箇所に普通の変数が使用されていました。 (SQLSTATE 42804)

-215 (ECPG_DATA_NOT_ARRAY) #

The database returned an ordinary variable in a place that requires array value. (SQLSTATE 42804) 配列値が必要な箇所にデータベースが普通の変数を返しました。 (SQLSTATE 42804)

-216 (ECPG_ARRAY_INSERT) #

The value could not be inserted into the array. (SQLSTATE 42804) 値を配列に挿入できません。 (SQLSTATE 42804)

-220 (ECPG_NO_CONN) #

The program tried to access a connection that does not exist. (SQLSTATE 08003) 存在しない接続にプログラムがアクセスしようとしました。 (SQLSTATE 08003)

-221 (ECPG_NOT_CONN) #

The program tried to access a connection that does exist but is not open. (This is an internal error.) (SQLSTATE YE002) 存在するが開いていない接続にプログラムがアクセスしようとしました (これは内部エラーです)。 (SQLSTATE YE002)

-230 (ECPG_INVALID_STMT) #

The statement you are trying to use has not been prepared. (SQLSTATE 26000) 使用しようとしたSQL文がプリペアされていませんでした。 (SQLSTATE 26000)

-239 (ECPG_INFORMIX_DUPLICATE_KEY) #

Duplicate key error, violation of unique constraint (Informix compatibility mode). (SQLSTATE 23505) 重複キーエラー。一意性制約違反(Informix互換モード)。 (SQLSTATE 23505)

-240 (ECPG_UNKNOWN_DESCRIPTOR) #

The descriptor specified was not found. The statement you are trying to use has not been prepared. (SQLSTATE 33000) 指定した記述子が見つかりませんでした。 使用しようとしたSQL文はプリペアされていませんでした。 (SQLSTATE 33000)

-241 (ECPG_INVALID_DESCRIPTOR_INDEX) #

The descriptor index specified was out of range. (SQLSTATE 07009) 記述子のインデックスが範囲外でした。 (SQLSTATE 07009)

-242 (ECPG_UNKNOWN_DESCRIPTOR_ITEM) #

An invalid descriptor item was requested. (This is an internal error.) (SQLSTATE YE002) 無効な記述子項目が要求されました。(これは内部エラーです。) (SQLSTATE YE002)

-243 (ECPG_VAR_NOT_NUMERIC) #

During the execution of a dynamic statement, the database returned a numeric value and the host variable was not numeric. (SQLSTATE 07006) 動的なSQL文の実行時にデータベースが数値を返しましたが、ホスト変数が数値でありませんでした。 (SQLSTATE 07006)

-244 (ECPG_VAR_NOT_CHAR) #

During the execution of a dynamic statement, the database returned a non-numeric value and the host variable was numeric. (SQLSTATE 07006) 動的なSQL文の実行時にデータベースが数値以外を返しましたが、ホスト変数が数値でした。 (SQLSTATE 07006)

-284 (ECPG_INFORMIX_SUBSELECT_NOT_ONE) #

A result of the subquery is not single row (Informix compatibility mode). (SQLSTATE 21000) 副問い合わせの結果が単一行ではありません(Informix互換モード)。 (SQLSTATE 21000)

-400 (ECPG_PGSQL) #

Some error caused by the <productname>PostgreSQL</productname> server. The message contains the error message from the <productname>PostgreSQL</productname> server. PostgreSQLサーバで何らかのエラーが発生しました。 このメッセージはPostgreSQLサーバからのエラーメッセージを含みます。

-401 (ECPG_TRANS) #

The <productname>PostgreSQL</productname> server signaled that we cannot start, commit, or rollback the transaction. (SQLSTATE 08007) PostgreSQLサーバがトランザクションのコミットやロールバックを始めることができないことを通知しました。 (SQLSTATE 08007)

-402 (ECPG_CONNECT) #

The connection attempt to the database did not succeed. (SQLSTATE 08001) データベースへの接続試行に失敗しました。 (SQLSTATE 08001)

-403 (ECPG_DUPLICATE_KEY) #

Duplicate key error, violation of unique constraint. (SQLSTATE 23505) 重複キーエラー。一意性制約違反。 (SQLSTATE 23505)

-404 (ECPG_SUBSELECT_NOT_ONE) #

A result for the subquery is not single row. (SQLSTATE 21000) 副問い合わせの結果が単一行ではありません。 (SQLSTATE 21000)

currently not used by the code <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-unrecognized"> <term>-600 (<symbol>ECPG_WARNING_UNRECOGNIZED</symbol>)</term> <listitem> <para> An unrecognized warning was received from the server. </para> </listitem> </varlistentry> <varlistentry id="ecpg-sqlstate-sqlcode-ecpg-warning-query-ignored"> <term>-601 (<symbol>ECPG_WARNING_QUERY_IGNORED</symbol>)</term> <listitem> <para> Current transaction is aborted. Queries are ignored until the end of the transaction block. </para> </listitem> </varlistentry>
-602 (ECPG_WARNING_UNKNOWN_PORTAL) #

An invalid cursor name was specified. (SQLSTATE 34000) 無効なカーソル名が指定されました。 (SQLSTATE 34000)

-603 (ECPG_WARNING_IN_TRANSACTION) #

Transaction is in progress. (SQLSTATE 25001) トランザクションが進行中です。 (SQLSTATE 25001)

-604 (ECPG_WARNING_NO_TRANSACTION) #

There is no active (in-progress) transaction. (SQLSTATE 25P01) 活動中(進行中)のトランザクションがありません。 (SQLSTATE 25P01)

-605 (ECPG_WARNING_PORTAL_EXISTS) #

An existing cursor name was specified. (SQLSTATE 42P03) 既存のカーソル名が指定されました。 (SQLSTATE 42P03)