查询占用无限时间

时间:2019-04-02 12:41:58

标签: python cx-oracle

这是我的代码,查询在无限循环中进行,没有任何错误或异常

import cx_Oracle
ip=''
port=''
sid=''
dns_tns=cx_Oracle.makedsn(ip,port,sid)
con = cx_Oracle.connect('username','password',str(dns_tns))
cursor = con.cursor()
print("start")
B={'APP_NAME': 'Hello', 'ISSUE_NAME': 'SP_164', 'ISSUE_TYPE': 'CR', 'DEVELOPER': 'username','TESTER': '','RELEASE_NO': '4.0', 'EST_DATE': '2018-10-10', 'ACT_DATE': '2018-10-10',\
  'DETECTED_PHASE': '',  'ISSUE_TRACKING_TOOL': 'SHAREPOINT','ID': 11}
sql_update = "UPDATE ISSUE SET ISSUE_TRACKING_TOOL = :ISSUE_TRACKING_TOOL,APP_NAME = :APP_NAME,\
RELEASE_NO = :RELEASE_NO,ISSUE_TYPE = :ISSUE_TYPE,DEVELOPER = :DEVELOPER,TESTER = :TESTER,\
ISSUE_NAME = :ISSUE_NAME,DETECTED_PHASE = :DETECTED_PHASE ,EST_DATE = TO_DATE(:EST_DATE, 'YYYY/MM/DD') \
,ACT_DATE = TO_DATE(:ACT_DATE, 'YYYY/MM/DD') WHERE ID = :ID"
cursor.execute(sql_update,B)
print("done")
con.commit()
con.close()

1 个答案:

答案 0 :(得分:0)

您可能正在经历另一个会话进行锁定的结果。您可以检查dba_locks视图以查看您的会话是否被另一个会话阻止,以及它是哪个会话。