title: Retrieving an Oracle timestamp using Python's Win32 ODBC module
body: <p>Given an Oracle table created using the following:</p>
  
  <pre><code>CREATE TABLE Log(WhenAdded TIMESTAMP(6) WITH TIME ZONE);
  </code></pre>
  
  <p>Using the Python ODBC module from its <a href="http://www.python.org/download/windows/" rel="nofollow noreferrer">Win32 extensions</a> (from the win32all package), I tried the following:</p>
  
  <pre><code>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()
  </code></pre>
  
  <p>When I run this, I get the following:</p>
  
  <pre><code>Traceback (most recent call last):
  ...
      results = cursor.fetchall()
  dbi.operation-error: [Oracle][ODBC][Ora]ORA-00932: inconsistent datatypes: expected %s got %s 
  in FETCH
  </code></pre>
  
  <p>The other data types I've tried (VARCHAR2, BLOB) do not cause this problem. Is there a way of retrieving timestamps?</p>