0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

IBM DB2 - レジストリー変数「DB2_COMPATIBILITY_VECTOR」の設定値によって、SQLCODE=-302, SQLSTATE=22001 が発生したりしなかったり

Last updated at Posted at 2016-04-21

1. はまったこと

  • レジストリー変数「DB2_COMPATIBILITY_VECTOR」の設定値によって、SQLCODE=-302, SQLSTATE=22001 が発生したりしなかったり

2. 起きたこと

2.1. 条件とか

  • IBM DB2 v10.5 Express-C
  • Table
> db2 describe table foo
           データ・タイ   データ・     列の   スケ
列名       プ・スキーマ   タイプ名     長さ   ール   NULL
---------- ------------ ------------ ------ ----- -----
ID         SYSIBM       INTEGER      4      0     いいえ
NAME       SYSIBM       VARCHAR      10     0     いいえ
  • Data
ID   NAME
---- ----------
   1 John
   2 Paul
  • Query
    select id, name from foo where name = ?

  • name = ?にNAME列の長さ10を超える値を設定
    例えば、「John」ならID=1, NAME=Johnのレコードが取得できるけど、「Pauuuuuuuul」なら対象レコードないはず

  • DB2_COMPATIBILITY_VECTORの設定値を変更する
    MYS
    ORA
    SYB
    設定なし

2.2. 結果

  • MYS、ORA、SYB

対象レコードなし
例外発生しない

  • 設定なし

以下のようなSQLExceptionが発生した
com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null, DRIVER=4.18.60

SQL0302N
EXECUTE または OPEN ステートメント内のホスト変数の値が、対応する使用の範囲外にあります。
http://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.messages.sql.doc/doc/msql00302n.html?lang=ja

3. 反省すること

おわり。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?