简体   繁体   中英

Passing an array of long strings ( >4000 bytes) to an Oracle (11gR2) stored procedure using cx_Oracle

We need to bulk load many long strings (>4000 Bytes, but <10,000 Bytes) using cx_Oracle. The data type in the table is CLOB. We will need to load >100 million of these strings. Doing this one by one would suck. Doing it in a bulk fashion, ie using cursor.arrayvar() would be ideal. However, CLOB does not support arrays. BLOB, LOB, LONG_STRING LONG_RAW don't either. Any help would be greatly appreciated.

Off the wall suggestion, but since you are on 11gR2 have a look at DBFS From the 'load' point of view, you are just copying files and they 'appear' as LOBs. You can do a similar thing with the built-in FTP server but file handling is a lot easier.

You just then write a procedure that pulls them from the dbfs_content view and pushes them to your procedure.

The other though, is, if they are all under 12,000 bytes, split them into three parts and deal with them as three separate VARCHAR2(4000) strings and join them up again on the PL/SQL side.

In the interest of getting shit done that is good enough, we did the abuse of the CLOB I mentioned in my comment. It took less than 30 minutes to get coded up, runs fast and works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM