见了很多写的很垃圾决定自己写 # coding=utf-8 import cx_Oracle import os import json os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8' """python version 3.7""" class TestOracle(object): def __init__(self,user,pwd,ip,port,sid): self.connect=cx_Oracle.connect(user+"/"+pwd+"@"+ip+":"+port+"/"+sid) self.cursor=self.connect.cursor() """处理数据二维数组,转换为json数据返回""" def select(self,sql): list=[] self.cursor.execute(sql) result=self.cursor.fetchall() col_name=self.cursor.description for row in result: dict={} for col in range(len(col_name)): key=col_name[col][0] value=row[col] dict[key]=value list.append(dict) js=json.dumps(list,ensure_ascii=False,indent
python cx_oracle批量插入查询,删除,update 操作oracle数据库
最新推荐文章于 2023-09-07 08:51:50 发布