cx_오라클:ORA-xxxxx 오류 번호는 어떻게 알 수 있나요?
문제
Try/Exception 블록에서 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
제휴하지 않습니다 StackOverflow