Binding LOB input value to stored procedure with PDO_OCI
| From: | Jessie Hernandez | Date: | Fri, 15 Dec 2006 22:14:45 +0000 |
| Subject: | Binding LOB input value to stored procedure with PDO_OCI | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-4413@lists.php.net to get a copy of this message | ||
I'm trying to bind a LOB value to a stored procedure call in Oracle. Since
there is no RETURNING clause for a stored procedure call, I cannot use the
EMPTY_CLOB() trick that's in the documentation.
I've tried several things (including creating a CLOB in another statement
using the DBMS_LOB.CREATETEMPORARY method), but nothing has worked. Here's
some sample code of what I'm trying to do. With the oic8 extension, one
would first have to create a BLOB using the oci_new_descriptor function,
then bind that to the statement. Since there's no "oci_new_descriptor"
equivalent in PDO_OCI, I cannot create the CLOB beforehand. Is the following
possible for PDO_OCI?
--- STORED PROCEDURE ---
create procedure test_clob(value in clob);
--- PHP CODE ---
<?php
$connection = new PDO( 'oci:dbname=mydb' );
$clob = fopen( 'myfile', 'r' );
$statement = $connection->prepare( 'begin test_clob( ? ); end;' );
$statement->bindParam( 1, $clob, PDO::PARAM_LOB );
$statement->execute();
/*
above generates an error:
SQLSTATE[HY000]: General error: 6550 OCIStmtExecute: ORA-06550: line 1,
column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST_CLOB'
*/
?>
If the above is not possible with Oracle, can a method be provided to create
descriptors only for the PDO_OCI extension? I'm willing to help implement
this, as the logic would be the same as the one in the oci8 extension.
Please let me know. Thanks.
Regards,
Jessie Hernandez