环境:
windows 2003 sp2 ent
Oracle9.2.0.8 for win
php 5.2.3问题:
如何一次插入多个clob到Oracle呢?在网上找了半天,没有发现有这样的介绍的.我测试了Oracle的例子:
http://www.oracle.com/technology/pub...ecks_lobs.htmlInserting a LOBTo INSERT an internal LOB, you first need to initialize the LOB using the respective Oracle EMPTY_BLOB or EMPTY_CLOB functions—you cannot update a LOB that contains a NULL value.Once initialized, you then bind the column to a PHP OCI-Lob object and update the LOB content via the object's save() method.The following script provides an example, returning the LOB type from the INSERT query:<?php
// connect to DB etc...$sql = "INSERT INTO
mylobs
(
id,
mylob
)
VALUES
(
mylobs_id_seq.NEXTVAL,
--Initialize as an empty CLOB
EMPTY_CLOB()
)
RETURNING
--Return the LOB locator
mylob INTO :mylob_loc";$stmt = oci_parse($conn, $sql);// Creates an "empty" OCI-Lob object to bind to the locator
$myLOB = oci_new_descriptor($conn, OCI_D_LOB);// Bind the returned Oracle LOB locator to the PHP LOB object
oci_bind_by_name($stmt, ":mylob_loc", $myLOB, -1, OCI_B_CLOB);// Execute the statement using , OCI_DEFAULT - as a transaction
oci_execute($stmt, OCI_DEFAULT)
or die ("Unable to execute query\n");// Now save a value to the LOB
if ( !$myLOB->save('INSERT: '.date('H:i:s',time())) ) {// On error, rollback the transaction
oci_rollback($conn);} else {// On success, commit the transaction
oci_commit($conn);}// Free resources
oci_free_statement($stmt);
$myLOB->free();
// disconnect from DB etc.
?>这个例子也仅仅用了一个clob,我想插入多个clob有什么好办法么?
谢谢了...