Oracle大数据量读取:LOB variable no longer valid after subsequent fetch

Stack Overflow解决方案:

cx_Oracle版本问题,在cx_Oracle5版本上有部分限制,在cx_Oracle6版本上没有此项限制。

This is a limitation of versions of cx_Oracle 5 and earlier. The new version (cx_Oracle 6) doesn't have this limitation. You can upgrade using this command:

python -m pip install cx_Oracle --upgrade

更新完成之后,程序运行通过。

原因分析:

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

In cx_Oracle 5 and earlier the LOB locators were stored in the array used for fetching; so each round trip to the database would overwrite the LOB locators from the previous fetch. In cx_Oracle 6, the LOB locators are associated with the LOBs themselves. 

加入此项限制的原因:

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、付费专栏及课程。

余额充值