note 37174 modified in function.ocinewdescriptor by sixd
| From: | sixd@php.net | Date: | Thu, 08 Oct 2009 19:27:16 +0000 |
| Subject: | note 37174 modified in function.ocinewdescriptor by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161548@lists.php.net to get a copy of this message | ||
I found another method of inserting/updating lob data. It works the same was as passing lob
parameters to a stored procedure and avoids the need for a RETURNING clause.
$lob = OCINewDescriptor($conn, OCI_D_LOB);
$stmt = OCIParse($conn,"insert into $table (id, the_blob)
values(my_seq.NEXTVAL, :the_blob)");
OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB);
$lob->WriteTemporary($data);
OCIExecute($stmt, OCI_DEFAULT);
$lob->close();
$lob->free();
OCICommit($conn);
There are some cases involving triggers where you can't use a RETURNING clause, so this method
can come in handy. The case where I needed it was updating a view that had an instead-of update
trigger.
--was--
I found another method of inserting/updating lob data. It works the same was as passing lob
parameters to a stored procedure and avoids the need for a RETURNING clause.
$lob = OCINewDescriptor($conn, OCI_D_LOB);
$stmt = OCIParse($conn,"insert into $table (id, the_blob)
values(my_seq.NEXTVAL, :the_blob)");
OCIBindByName($stmt, ':the_blob', &$lob, -1, OCI_B_BLOB);
$lob->WriteTemporary($data);
OCIExecute($stmt, OCI_DEFAULT);
$lob->close();
$lob->free();
OCICommit($conn);
There are some cases involving triggers where you can't use a RETURNING clause, so this method
can come in handy. The case where I needed it was updating a view that had an instead-of update
trigger.
http://php.net/manual/en/function.ocinewdescriptor.php