Has anyone come across difficulty updating a CLOB in Oracle? I have been
able to follow the documentation to insert a new clob by first inserting an
EMPTY_CLOB() into the row, and then calling the save method of the
OCINewDescriptor/CLOB locator:

$conn = OCILogon("username", "password", "connect_string");
$clob_loc = OCINewDescriptor($conn, OCI_D_LOB);
$sql = "INSERT INTO emp (empno, name, life_story) VALUES (emp_seq.NEXTVAL,
:name, EMPTY(CLOB)) RETURNING life_story INTO :clob_loc";
$stmt = OCIParse($conn, $sql);
OCIBindByName($stmt, ":name", &$name, -1);
OCIBindByName($stmt, ":life_story", &$clob_loc, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);

However, attempts to "SELECT life_story INTO :clob_loc FROM emp WHERE empno
= 123 FOR UPDATE" have failed. Similarly, "UPDATE emp SET name = 'NEW_NAME'
WHERE empno = 123 RETURNING life_story INTO :clob_loc" have also failed. The
error message is the same:

Warning: OCILobWrite: OCI_INVALID_HANDLE in /home/acarlos/update.php on line

However, if I update the row and set the CLOB column to anything new
(including EMPTY_CLOB()), no error occurs.

When it fails, I've checked the class of the OCINewDescriptor and it is
indeed an object with 6 class methods (as it should be).

Has anyone run into this? Is this a bug in PHP's implementation of OCI?

Also, is there a limit to the amount of data that can be stored in the CLOB
using this method? My uploads have been truncated to a little less than 32K.
And I thought using a CLOB was supposed to give me access to 4GB...

Thanks for any insight!

Anthony Carlos

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to