cx_oracle을 사용하여 Python에서 Oracle에 액세스하려고합니다.oracle 오류 코드 처리 cx_oracle
행을 반환하지 않는 select 문이 있습니다. 즉; NO_DATA_FOUND .. 그리고 이것은 오류 상태를 처리하는 방법입니다.
나는이 코드 조각을 실행하면 오류 NO_DATA_FOUND가 cx_oracle.error 또는 cx_oracle.Databaseerror 또는 cx_oracle.Warning에 의해 사로 잡았되지 ..
은 어떻게 NO_DATA_FOUND 조건을 처리하나요?
code.py
이것은 당신의 예외 중 어느 것도 트리거되지되고있는 이유는 아마도 오류 조건이 아닌def DetermineNames(self):
sql = """select NAME from EMP_TAB where fd_fle_id = %s"""%(self.fileid)
try:
self.cursor.execute(sql)
result = self.cursor.fetchall()
for row in result:
print('row',row)
except cx_Oracle.Error as e:
print("Error:Unable to determine the RAW_OBJ_NAME: Object Name:%s, Function Name:%s Error:%s")%(self.__class__.__name__,sys._getframe().f_code.co_name,
str(e).strip())
except cx_Oracle.DatabaseError as e:
print("Error:Unable to determine the RAW_OBJ_NAME: Object Name:%s, Function Name:%s Error:%s")%(self.__class__.__name__,sys._getframe().f_code.co_name,
str(e).strip())
except cx_Oracle.Warning as e:
print("Error:Unable to determine the RAW_OBJ_NAME: Object Name:%s, Function Name:%s Error:%s")%(self.__class__.__name__,sys._getframe().f_code.co_name,
str(e).strip())
return self.rawname
감사합니다 ... 각 SQL 문을 실행 한 후 오류 코드를 확인 할 수있는 방법은 객체가 아니라 실제 코드가 나는 인쇄 - cx_Oracle._Error.code..It 때? ... – user1050619