How do I read cx_Oracle.LOB data in Python?

前端 未结 4 587
庸人自扰
庸人自扰 2020-12-31 04:06

I have this code:

    dsn = cx_Oracle.makedsn(hostname, port, sid)
    orcl = cx_Oracle.connect(username + \'/\' + password + \'@\' + dsn)
    curs = orcl.cu         


        
4条回答
  •  离开以前
    2020-12-31 04:45

    You basically have to loop through the fetchall object

    dsn = cx_Oracle.makedsn(hostname, port, sid)
    orcl = cx_Oracle.connect(username + '/' + password + '@' + dsn)
    curs = orcl.cursor()
    sql = "select TEMPLATE from my_table where id ='6'"
    curs.execute(sql)
    rows = curs.fetchall()
    for x in rows:
       list_ = list(x)
       print(list_)
    

提交回复
热议问题