【发布时间】:2018-01-23 16:30:30
【问题描述】:
我正在尝试使用python 脚本将来自csv 的记录插入oracle 11g 数据库。
主要是应用程序成功插入了一些记录,但后来抛出此异常 Error <class 'cx_Oracle.DatabaseError'> 。
def orcl_proc(sql):
# Open database connection
db = cx_Oracle.connect('username/password@localhost/XE')
# prepare a cursor object using cursor() method
cursor = db.cursor()
try:
# Execute the SQL command
cursor = cursor.execute(sql)
# Commit your changes in the database
db.commit()
except cx_Oracle.DatabaseError as e:
# Log error as appropriate
error, = e.args
print('Error.code =', error.code)
print('Error.message =', error.message)
print('Error.offset =', error.offset)
# Rollback in case there is any error
db.rollback()
# disconnect from server
db.close()
#print('Closed')
错误:
<class 'cx_Oracle.DatabaseError'>
在 56,367 条记录中,python 应用程序只能插入 180 条记录。任何人都可以帮助我,在此先感谢。
【问题讨论】: