By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,617 Members | 1,166 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,617 IT Pros & Developers. It's quick & easy.

php+oracle+insert multiple clob

P: n/a
Hello,

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!

Oct 3 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.