以下を使用して作成されたOracleテーブルがあるとします。
CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME ZONE);
Win32拡張機能(win32allパッケージから)のPython ODBCモジュールを使用して、次のことを試しました。
import dbi, odbc
connection = odbc.odbc("Driver=Oracle in OraHome92;Dbq=SERVER;Uid=USER;Pwd=PASSWD")
cursor = connection.cursor()
cursor.execute("SELECT WhenAdded FROM Log")
results = cursor.fetchall()
これを実行すると、次のようになります。
Traceback (most recent call last):
...
results = cursor.fetchall()
dbi.operation-error: [Oracle][ODBC][Ora]ORA-00932: inconsistent datatypes: expected %s got %s
in FETCH
私が試した他のデータ型(VARCHAR2、BLOB)では、この問題は発生しません。タイムスタンプを取得する方法はありますか?