oracle数据库操作(未封装)

#-*- coding:utf-8 -*-

import cx_Oracle
import os

os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'    #读取数据中文全是问号的问题
conn = cx_Oracle.connect('用户名/密码@ip地址:端口号/数据库名称')
cursor = conn.cursor()



cursor.execute("select * from lb_t_into_info where into_app_id='120152306487' ")
s = cursor.fetchone()[6] #获取一条数据的第6列
print(s)
print(type(s))



# cursor.execute("select * from sys_role")
#
# rows = cursor.fetchall()  # 得到所有数据集
# for row in rows:
#     print("%d, %s, %s, %s" % (row[0], row[1], row[2], row[3]))
#
# print("Number of rows returned: %d" % cursor.rowcount)


cursor.close()
conn.close()

  

posted @ 2020-05-15 16:47  不不田鼠  阅读(91)  评论(0编辑  收藏  举报