[編者註:在 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);
}
?>