首页 > 代码库 > python循环插入数据 oracle

python循环插入数据 oracle

python链接oracle,要安装cx_Oracle

代码:

#-*-coding=utf-8
import cx_Oracle
import math

Comn=cx_Oracle.Connection(‘system/wzh123456@192.168.0.40/orcl‘)

Cur=Comn.cursor()
for i in range(1, 100):
  Cur.execute("insert into business_reconciliation_tbl(id,merchant_name,settle_money,is_del,state,merchant_id) values(‘%s‘,‘%s‘,‘%s‘,‘%s‘,‘%s‘,‘%s‘)" %(i, "test01","100","0","0","EFB8B43400D549EA919431AA85FEE0E4"))
  Comn.commit()

Cur.close()
Comn.close()

python循环插入数据 oracle