0
我試圖在執行以執行cx_Oracle以下查詢,但得到以下錯誤: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()
必須有更多的代碼在某處......如果'conn'是一個連接,就沒有'conn.exec'這樣的東西。如果它是一個遊標,那麼它應該是** cursor.execute **。你在使用其他圖書館嗎? – Gerrat
它的execute..typo錯誤 – user1050619
你能發佈一個完整的例子來顯示你的問題(你可以使用一個虛擬的連接字符串)。你沒有展示出導致問題的真正原因,也沒有看到它,我們無法幫助你。當您嘗試創建更完整的示例時,您可能會發現您的問題。 – Gerrat