Now I ran into this problem using cx_Oracle 5.0.4 with Unicode support. The above solution did not help me. The DELETED column in the question is a numeric column, which causes this error.
According to the mailing list ( http://comments.gmane.org/gmane.comp.python.db.cx-oracle/2390 ), this could be an error in Oracle that only appears in cx_Oracle with Unicode support.
link: "When I create cx_Oracle without Unicode support, everything works as expected. When I create cx_Oracle with Unicode support, I try to use a query that returns a numeric value (for example):
con = Connection( ... ) cur = con.cursor() cur.execute( 'SELECT 1 FROM DUAL' ) rows = cur.fetchall()
leads to this exception:
cx_Oracle.DatabaseError: OCI-22061: invalid format text [T
"
What I did to get around this is in the select, do statement:
cur.execute( 'SELECT to_char(1) FROM DUAL' ) rows = cur.fetchall() for row in rows: val = int(row[0])
This is pretty ugly, but it works.
source share