我是 Python 新手,使用 cx_Oracle.execute 在表中插入一行。
我准备了insert适用于 SQL 开发人员的语句。
print执行之前的语句表明它在执行时挂起。一个简单的select语句使用相同的包。
我也在 Anaconda 上试过这个,结果相同。
import cx_Oracle
Connection = cx_Oracle.connect('connectioninfo')
cursor = connection.cursor()
print(cx_Oracle.__file__)
print(cx_Oracle._version)
sql1 = "insert into date_dim(dateid) values (20170523)"
print(sql1)
cursor.execute(sql1) # hangs here
count = cursor.rowcount
print(count)
connection.commit() # Never gets to this statement
cursor.close()
connection.close()
Run Code Online (Sandbox Code Playgroud)