php+oracle+insert multiple clob
am 03.10.2007 13:15:12 von davide.muraroHello,
This query (PHP+Oracle) works:
global $user,$pass,$sid;
$db_charset = 'UTF8';
$db = OCILogon($user, $pass, $sid, $db_charset);
$clob = OCINewDescriptor($db, OCI_D_LOB);
$txt_clob = $arguments['txt_clob_value_post'];
$query = "INSERT INTO tbl_emm_data (*,*,*,*,*,*,*,)
VALUES (*,*,*,*,*, EMPTY_CLOB(), *,*,*)";
$stmt = OCIParse($db, $query." returning txt_clob into :the_blob");
OCIBindByName($stmt, ':the_blob', &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
if($clob->save($txt_clob))
{
OCICommit($db);
}
else
{
//ERROR clob
}
OCIFreeStatement($stmt);
OCILogoff($db);
I need to insert 2 clob values at the same time:
I copied the code from the manual, but naturally it doesn't work.
The error is: INVALID_OCI_HANDLE, the resolution of the ora00913 is:
check you bind parameter. (stupid??? Nooo!!!)
$txt_1 = $arg['txt_1'];
$txt_2 = $arg['txt_2'];
$query = "INSERT INTO tbl_emm_data (*,*,*,*,*,*,*,) VALUES
(*,*,*,*,*,
EMPTY_CLOB(),EMPTY_CLOB() *,*,*)";
$stmt = OCIParse($dbh, $query);
$clob1 = OCINewDescriptor($dbh, OCI_D_LOB);
$clob2 = OCINewDescriptor($dbh, OCI_D_LOB);
OCIBindByName ($stmt, ":txt_1", &$clob1, -1, OCI_B_CLOB);
OCIBindByName ($stmt, ":txt_2", &$clob2, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$clob1->save($txt_1);
$clob2->save($txt_2);
OCICommit($dbh);
Any idea?
Thanks In advance!