LOB variable no longer valid after subsequent fetch

cx_oracle读取oracle wm_concate函数操作过后的长文本clob字段,当使用fetchall或者fetchmany读取数据时,报上面的错

参考下面的文档,发现只能使用下面2种方式中的任一种来操作数据,总体来说,大数据量时读取效率不高。
通过to_char(wm_concat(brand_name))把clob字段变成varchar字段后,再采用cursorSelect.fetchmany(1000),对于30W条数据的处理时间从10分钟减少到1分半!

for result in cursorSelect:
尝试了几次感觉效率比下面的稍微好点
或者
result = cursorSelect.fetchone() 自己控制while循环读取


参考[url=http://cx-oracle.sourceforge.net/html/lob.html]Lob objects[/url]
Internally, Oracle uses LOB locators which are allocated based on the cursor array size. Thus, it is important that the data in the LOB object be manipulated before another internal fetch takes place. The safest way to do this is to use the cursor as an iterator. In particular, do not use the fetchall() method. The exception “LOB variable no longer valid after subsequent fetch” will be raised if an attempt to access a LOB variable after a subsequent fetch is detected.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值