【发布时间】:2019-08-14 10:23:22
【问题描述】:
我有这段代码可以从我的数据库的 blob 列中获取文本:
import cx_Oracle
ip = 'your host'
port = 1521
SID = 'ORCL'
USER = 'user'
PASSWORD = 'password'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
dsn = cx_Oracle.makedsn(ip, port, SID)
orcl = cx_Oracle.connect(USER + '/' + PASSWORD + '@' + dsn)
curs = orcl.cursor()
sql = """SELECT blob_column from table"""
curs.execute(sql)
rows = curs.fetchall()
for x in rows:
list_ = list(x)
print(x[0].read)
但是当我用 for 打印时,我得到了这个结果:
<built-in method read of cx_Oracle.LOB object at 0x0547EAE8>
<built-in method read of cx_Oracle.LOB object at 0x0547EAD0>
<built-in method read of cx_Oracle.LOB object at 0x0711D770>
如何从我的 blob 列返回文本?
【问题讨论】:
标签: python python-3.x oracle python-2.7