[编辑注:不要在 PHP 5 中的绑定调用中对参数使用“&”]
上面的代码在某种程度上是正确的……以下是我让 CLOB 工作的示例
<?php
function insert_adinfo($AdInfoID, $MagazineType, $Publish, $DatePost, $BodyText)
{
global $db;
$clob = OCINewDescriptor($db, OCI_D_LOB);
$stmt = OCIParse($db,"insert into tblAdInfo values ($AdInfoID, $MagazineType, '$Publish', to_date('$DatePost', 'YYYY-MM-DD'), EMPTY_CLOB()) returning BodyText into :the_blob");
OCIBindByName($stmt, ':the_blob', &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
if($clob->save($BodyText)){
OCICommit($db);
}else{
echo "问题:无法上传Clob\n";
}
OCIFreeDescriptor($clob);
OCIFreeStatement($stmt);
}
?>