6. LOB Objects

NOTE: This object is an extension the DB API. It is returned whenever Oracle CLOB and BLOB columns are fetched.

NOTE: 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.

read( [offset = 1, [amount]])
Return a portion (or all) of the data in the LOB object.

size( )
Returns the size of the data in the LOB object.

trim( [newSize = 0])
Trim the LOB to the new size.

write( data, [offset = 1])
Write the data to the LOB object at the given offset. Note that if you want to make the LOB value smaller, you must use the trim() function.