在 try/except block 中,如何提取 Oracle 错误号?
最佳答案
try:
cursor.execute("select 1 / 0 from dual")
except cx_Oracle.DatabaseError, e:
error, = e
print "Code:", error.code
print "Message:", error.message
这会产生以下输出:
Code: 1476
Message: ORA-01476: divisor is equal to zero
关于python - cx_Oracle : how do I get the ORA-xxxxx error number?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40586/