我正在尝试在 cx_Oracle 中执行以下查询,但在执行时出现以下错误:
print 'Error.code =', error.code
AttributeError: 'str' object has no attribute 'code'
代码:
try:
conn.exec("Select * from table1")
except cx_Oracle.DatabaseError, ex:
error, = ex.args
print 'Error Inserting Field Base'
print 'Error.code =', error.code
print 'Error.message =', error.message
print 'Error.offset =', error.offset
conn.rollback()