我正在尝试在 try except 块中从表中删除特定行,但出现以下错误
self.returnvals['ERROR_CD'] = error.code
AttributeError: 'str' object has no attribute 'code'
代码:
try:
# code deleting from a table
except cx_Oracle.DatabaseError, ex:
error, = ex.args
self.conn.rollback()
self.returnerr['ID'] = 0
self.returnerr['ERROR_CD'] = error.code
self.returnerr['ERROR_MSG'] = error.message
self.returnerr['TABLE_NAME'] = self.debug_val