I have a column in the DB which is of type CLOB
and I can't get the value in PHP as it is shown as
"resource id='204' type='"oci8 descriptor"'".
My adapter code:
$this->_db->fetchRow(
$this->_db->select()
->from(self::TABLE_NAME, array(
'BODY'
))
This is covered in The Underground PHP and Oracle Manual, page 234 "Fetching LOBs". Here's the example from that page:
<?php
$c = oci_connect('hr', 'welcome', 'localhost/XE');
$myblobid = 123;
$query = 'select blobdata from mybtab where blobid = :myblobid';
$s = oci_parse($c, $query);
oci_bind_by_name($s, ':myblobid', $myblobid);
oci_execute($s);
$arr = oci_fetch_array($s, OCI_ASSOC);
if (is_object($arr['BLOBDATA'])) { // protect against a NULL LOB
$data = $arr['BLOBDATA']->load();
$arr['BLOBDATA']->free();
echo $data;
}
?>
I would advise reading the manual page yourself as there is important advice about avoiding memory leaks and returning LOB data as a string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With