Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 try/except 块中,如何提取 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