Created
June 7, 2012 22:23
-
-
Save tyabuta/2892052 to your computer and use it in GitHub Desktop.
Oracleデータベースでバインド変数の設定方法 for VBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' I/Oタイプ | |
Const ORAPARM_INPUT = 1 | |
Const ORAPARM_OUTPUT = 2 | |
Const ORAPARM_BOTH = 3 | |
' 変数型 | |
Const ORATYPE_VARCHAR2 = 1 | |
Const ORATYPE_NUMBER = 2 | |
Const ORATYPE_SINT = 3 | |
Const ORATYPE_FLOAT = 4 | |
Const ORATYPE_STRING = 5 | |
Const ORATYPE_VARCHAR = 9 | |
Const ORATYPE_DATE = 12 | |
Const ORATYPE_UINT = 68 | |
Const ORATYPE_CHAR = 96 | |
Const ORATYPE_CHARZ = 97 | |
Const ORATYPE_CURSOR = 102 | |
' バインド変数を追加 | |
' Add(変数名, 初期値, I/Oタイプ) | |
OraDatabase.Parameters.Add "バインド変数名", 0, ORAPARM_INPUT | |
' バインド変数の型設定 | |
OraDatabase.Parameters("バインド変数名").ServerType = ORATYPE_CHAR | |
' バインド変数の値設定 | |
OraDatabase.Parameters("バインド変数名").Value = "a001" | |
' バインド変数の削除 | |
OraDatabase.Parameters.Remove "バインド変数名" | |
' SQLで、":バインド変数名"と記述する。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment