Search code examples
phporacle-databasecodeigniterclob

Object of class OCI-Lob could not be converted to string


I am trying to access CLOB type field's data from the Oracle database in CodeIgniter but getting the following error:

Message: Object of class OCI-Lob could not be converted to string

After var_dump getting result as follows:

enter image description here


Solution

  • The Oracle “CLOB” (Character Large Object) is a data type used to store up to 4 Gigabytes of text.

    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.

    Example:

    $result->FORUM_DESC->load();
    

    or

    $result->FORUM_DESC->read(2000);
    

    Source.