note 55201 modified in function.ocinewdescriptor by sixd
| From: | sixd@php.net | Date: | Thu, 08 Oct 2009 19:27:32 +0000 |
| Subject: | note 55201 modified in function.ocinewdescriptor by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161551@lists.php.net to get a copy of this message | ||
Here is an example of retrieving a CLOB as an output parameter from a stored procedure. This is a
bit hack-y and maybe there's a cleaner way to do this, but I couldn't find one. The
following definitely works with Oracle 9:
// the query to call the procedure, which includes declaring the
// output parameter and assigning the result to a variable to be bound.
$qry = '
declare clob_out clob;
begin
myprocedure(someparam_in, clob_out);
:myclob := clob_out;
end;
';
// parse the query and bind the 'myclob' variable
$sth = OCIParse($conn,$qry);
$myclob = OCINewDescriptor($conn,OCI_D_LOB);
OCIBindByName($sth,":myclob",$myclob,-1,OCI_B_CLOB);
OCIExecute($sth);
// display the results
echo $myclob->load();
--was--
Here is an example of retrieving a CLOB as an output parameter from a stored procedure. This is a
bit hack-y and maybe there's a cleaner way to do this, but I couldn't find one. The
following definitely works with Oracle 9:
// the query to call the procedure, which includes declaring the
// output parameter and assigning the result to a variable to be bound.
$qry = '
declare clob_out clob;
begin
myprocedure(someparam_in, clob_out);
:myclob := clob_out;
end;
';
// parse the query and bind the 'myclob' variable
$sth = OCIParse($conn,$qry);
$myclob = OCINewDescriptor($conn,OCI_D_LOB);
OCIBindByName($sth,":myclob",$myclob,-1,OCI_B_CLOB);
OCIExecute($sth);
// display the results
echo $myclob->load();
http://php.net/manual/en/function.ocinewdescriptor.php