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循环读取


参考 Lob objects
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.

你可能感兴趣的:(html,oracle,.net,python,Access)