note 64111 added to function.oci-new-descriptor
| From: | BenHubbardben at vonik dot com | Date: | Fri, 07 Apr 2006 16:57:45 +0000 |
| Subject: | note 64111 added to function.oci-new-descriptor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107530@lists.php.net to get a copy of this message | ||
Here is another example of how to insert a BLOB into table using a PL/SQL function.
Oracle Database Code:
create table blob_table ( the_blob blob);
create or replace function insert_blob(out_blob out blob)
return integer is
begin
insert into blob_table values (EMPTY_BLOB())
return the_blob into out_blob;
return 0; /* Success */
end insert_blob;
PHP Code:
<?php
$iResult = -1;
$strTestData = 'Testing 123';
$conn = oci_connect($user, $password);
$stmt = oci_parse($conn, "begin :RES := insert_blob(:OUT_BLOB); end;");
$objBlob = oci_new_descriptor($conn, OCI_D_LOB);
oci_bind_by_name($stmt, ":RES", $iResult);
oci_bind_by_name($stmt, ":OUT_BLOB", $objBlob, -1, OCI_B_BLOB);
oci_execute($stmt, OCI_DEFAULT);
$objBlob->write($strTestData);
oci_commit($conn);
$objBlob->free();
oci_free_statement($stmt);
?>
----
Server IP: 66.163.161.117
Probable Submitter: 68.114.12.209
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.oci-new-descriptor.php
Edit -- http://master.php.net/note/edit/64111
Del: integrated -- http://master.php.net/note/delete/64111/integrated
Del: useless -- http://master.php.net/note/delete/64111/useless
Del: bad code -- http://master.php.net/note/delete/64111/bad+code
Del: spam -- http://master.php.net/note/delete/64111/spam
Del: non-english -- http://master.php.net/note/delete/64111/non-english
Del: in docs -- http://master.php.net/note/delete/64111/in+docs
Del: other reasons-- http://master.php.net/note/delete/64111
Reject -- http://master.php.net/note/reject/64111
Search -- http://master.php.net/manage/user-notes.php