|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-04-27 21:44 UTC] Diomedes_01 at yahoo dot com
Description:
------------
I am receiving errors after upgrading from php 4.3.9 to php 5.0.4 when attempting to upload a clob to my Oracle database. The code has already been modified to follow the PHP 5 paradigm; but it is refusing to function. Code is as follows:
Reproduce code:
---------------
$sql1 = ("begin append_comments(:incident_id,:comments_id);end;");
$sth = oci_parse ( $connection, $sql1 ) or display_main_error();
$clob = oci_new_descriptor ($connection, OCI_D_LOB);
oci_bind_by_name ( $sth, ":incident_id", $incident );
oci_bind_by_name ($sth, ":comments_id", &$clob, -1, OCI_B_CLOB );
$clob->write($comments);
oci_execute ($sth, OCI_DEFAULT) or display_main_error();
oci_commit($connection);
$clob->free();
oci_free_statement($sth);
Expected result:
----------------
The above code should properly insert the clob into the Oracle database. The code executed correctly in php4.3.9 and the stored procedure being used functions normally in SQL*Plus.
Actual result:
--------------
I receive the following warnings from PHP when attempting to execute the code:
Warning: OCI-Lob::write() [function.write]: OCILobGetLength: OCI_INVALID_HANDLE in /www/htdocs/EtrackTest/oracle_update.php on line 218
Warning: oci_execute() [function.oci-execute]: OCIStmtExecute: ORA-22275: invalid LOB locator specified ORA-06512: at "SYS.DBMS_LOB", line 366 ORA-06512: at "ETRACK.APPEND_COMMENTS", line 14 ORA-06512: at line 1 in /www/htdocs/EtrackTest/oracle_update.php on line 219
The code I use is virtually identical to what exists in the PHP documentation.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 15:00:01 2025 UTC |
Unfortunately, my website is behind a firewall and contains company sensitive information; so I cannot grant access. The reproducible code is already included; please note that I attempted to continue using my previous PHP4 code (that worked beforehand) and it failed. That code was: <?php $sql1 = ("begin append_comments(:incident_id,:comments_id);end;"); $sth = OCIParse ( $connection, $sql1 ) or display_main_error(); $clob = OCINewDescriptor ($connection, OCI_D_LOB); OCIBindByName ( $sth, ":incident_id", &$incident, -1 ); OCIBindByName ($sth, ":comments_id", &$clob, -1, OCI_B_CLOB ); $clob->WriteTemporary($comments); OCIExecute ($sth, OCI_DEFAULT) or display_main_error(); $clob->close(); $clob->free(); OCIFreeStatement($sth); ?> When I attempted to execute the above code, I received a fatal error from PHP indicating that the writeTemporary method was not found. According to what I read in the documentation, it appears to not be part of the new OCI class. So when I followed the documentation and re-implemented the code following the instructions provided; which by the way, look like so: (straight from your online help) <?php /* Calling PL/SQL stored procedures which contain clobs as input * parameters (PHP 4 >= 4.0.6). * Example PL/SQL stored procedure signature is: * * PROCEDURE save_data * Argument Name Type In/Out Default? * ------------------------------ ----------------------- ------ -------- * KEY NUMBER(38) IN * DATA CLOB IN * */ $conn = oci_connect($user, $password); $stmt = oci_parse($conn, "begin save_data(:key, :data); end;"); $clob = oci_new_descriptor($conn, OCI_D_LOB); oci_bind_by_name($stmt, ':key', $key); oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); $clob->write($data); oci_execute($stmt, OCI_DEFAULT); oci_commit($conn); $clob->free(); oci_free_statement($stmt); ?> Here is the documentation URL: http://us2.php.net/manual/en/function.oci-new-descriptor.php That is when I receive a problem with regards to the 'write' method. So either this is a bug or a documentation problem; I know the stored procedure I am using works and that the variables being passed are valid. It works in SQL*Plus and it works if I revert back to PHP4. Please advise.