The Oracle “CLOB” (Character Large Object) is a data type used to store up to 4 Gigabytes of text. Retrieving the contents of a CLOB is not as intuitive as you might think.
Let’s say you have a CLOB field/column named “mychars” in an Oracle DB table named “mytable” along with some other fields. You want to simply echo out the text in the “mychars” field:
The above code will give you an error that looks like the following:
If you try to do a print_r() on the CLOB in an attempt to figure out what you are dealing with you will get something that looks like:
This is because a Lob object is returned instead of the contents of the CLOB.
To get the CLOB contents you will need to call the load() or read() methods on the returned object. The latter will require the length of data to read in bytes but has the advantage of not being limited by the script memory limit:
load(); //or echo $row['mychars']->read(2000); } } ?>