Forum Stats

  • 3,853,227 Users
  • 2,264,195 Discussions


What is the best way to pull back data from a CLOB field via PHP OCI8?

firstaspect96623234234 Member Posts: 2
edited Apr 16, 2014 3:38AM in PHP


I'm wanting to pull back data from an Oracle 11g database, part of which involves a CLOB field. I'm currently using the following:

while (($row = oci_fetch_array($sqlresult, OCI_ASSOC + OCI_RETURN_NULLS+OCI_RETURN_LOBS)) != false) { .....

on a parsed and executed statement to put the results into a PHP array. However it is very slow. For a query that only returns 10 rows, with one CLOB field containg around 5000 characters of data, it takes 5-6 seconds to run.

If I instead use a VARCHAR2 field with the full 4000 characters it runs in well under a second, as expected.

Am I doing something wrong? Or are CLOBS really that slow via OCI8.


This discussion has been closed.