[Zope-DB] DCOracle2: Repeatedly writing to a CLOB as easy as ...?

Matthew T. Kromer matt@zope.com
Thu, 10 Apr 2003 11:02:50 -0400

John Ziniti wrote:

> I have a large file (~150 MB) that I would like to write to a CLOB, but
> I would prefer not to:
> <code>
> data = file.read()
> clob.write(data)
> </code>
> I see a bit about the clob.write() method in the source. Is doing what I
> want as easy as:
> <code>
> offset = 0
> for line in file.xreadlines():
>    clob.write(line, offset)
>    offset += len(line)
> </code>

I think it should be...

However, consider for large CLOBs that you actually use FLOBs instead 
which is a read-only Oracle FILE lob -- you point Oracle at the data 
file and Oracle says, "OK, its a LOB now!"

Matt Kromer
Zope Corporation  http://www.zope.com/