note 53682 added to function.ocinewdescriptor
| From: | psergatinkfrogdotcom | Date: | Thu, 09 Jun 2005 04:22:49 +0000 |
| Subject: | note 53682 added to function.ocinewdescriptor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90151@lists.php.net to get a copy of this message | ||
How to insert big XML data as CLOB into table with XMLType field.
<?php
//CREATE TABLE sometable(
//id number(8) not null,
//record XMLType
//) XMLTYPE COLUMN record STORE AS OBJECT RELATIONAL
//XMLSCHEMA "someschema" ELEMENT "some_element";
//
$sql = "INSERT INTO sometable(id, record) VALUES(some_sequqnce.nextval,
sys.xmltype.createxml(:rec)) RETURNING ID INTO :rid";
$stmt = OCIParse($ora_conn,$sql);
$clob = OCINewDescriptor($ora_conn, OCI_D_LOB);
$rowid = OCINewDescriptor($ora_conn,OCI_D_ROWID);
OCIBindByName($stmt, ':rec', &$clob, -1,OCI_B_CLOB);
OCIBindByName($stmt, ':rid', $rowid, -1);
$clob->WriteTemporary($xml,OCI_TEMP_CLOB);
$success = OCIExecute($stmt,OCI_DEFAULT);
if(!$success) {
OCICommit($ora_conn);
}
OCIFreeStatement($stmt);
OCIFreeDesc($lob);
?>
I hope it will help :)
----
Manual Page -- http://www.php.net/manual/en/function.ocinewdescriptor.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53682
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53682&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53682&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53682&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53682&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53682&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53682&report=yes
Search -- http://master.php.net/manage/user-notes.php