views:

39

answers:

2

Hello,

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.

A: 

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.

Gary
We have 3 CLOB fields, each holds strings >4000 BYTES and we are hoping to load 1000 rows at a time.The DBFS approach does work, but I'm not a fan of string manipulation in PL/SQL as it is fragile and takes considerably longer to develop and test than anything done in a higher level language. From what we've seen, you don't obtain any performance benefit either from using PL/SQL in these cases. It is _not_ optimized for string manipulation.
daniel
A: 

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.

daniel