python如何保存从oracle数据库中读取的BLOB文件
2020-08-22 本文已影响0人
泡泡_e661
import cx_Oracle
con = cx_Oracle.connect(‘username’, ‘password’, ‘dsn’)
blob_sql = "select column_name from table where clause"
cursor = con.cursor()
cursor.execute(blob_sql)
result = cursor.fetchall()
file = open('file_name', "wb")
file.write(result[0][0].read()) #可以print查看result的内容,根据实际情况read
file.close()