import cx_Oracle
connection = cx_Oracle.Connection("Username/密码@Host:Port/SERVICE_NAME")
cursor = connection.cursor()
try:
cursor.execute("select 1 / 0 from dual")
except cx_Oracle.DatabaseError as exc:
error, = exc.args
print("Oracle-Error-Code:", error.code)
print("Oracle-Error-Message:", error.message)