hi,

i have been trying to update a CLOB (ORACLE) field using php. the following is the statement i have written.

<?
include(connect.inc);
$sql = "update articlemaster SET articletitle='$articletitle', channelid=$channelid, subchannelid=$subchannelid, articlesummary='$articlesummary', userlogin='$userName', articlenoofimages=$articlenoofimages, articlenotes='$articlenotes', articledescription='$articledescription', articleispublished='$articleispublished', articleisreviewed='$articleisreviewed', articlebody = EMPTY_CLOB() where articleid=$articleid returning articlebody into :artbody";

$clob = OCINewDescriptor($conn, OCI_D_LO😎;
$stmt = OCIParse($conn, $sql);
OCIBindByName($stmt, ':artbody', &$clob, -1, OCI_B_CLO😎;
OCIExecute($stmt,OCI_DEFAULT);
if($clob->save($articlebody)){
OCICommit($conn);
echo "<BR><BR><b>this is cool</b>";
}else{
echo "Problems: Couldn't upload Clob\n";
}
$clob->free();
OCIFreeStatement($stmt);
?>

in the above code the include file is for connecting to the database.

the Warning i am getting is as follows.

Warning: Cannot save a lob wich size is less than 1 byte in /projects/Indianguide/public_html/admin/articles/mod.php on line 11

can anybody help me out here. please try to make it ASAP.

thanks and regards gknair.

    Try it with an select for update:
    $req="SELECT data FROM bdata
    WHERE id='5' FOR UPDATE";
    $stmt=OCIParse($req);
    OCIExecute($stmt, OCI_DEFAULT);

    $req="UPDATE bdata SET data=:data WHERE id='5'";
    $stmt=OCIParse($req);
    OCIBindByName($stmt, ":data", $data, -1);
    OCIExecute($stmt, OCI_DEFAULT);
    OCICommit($conn);

    that should work...
    this waring indicates me, that you should update your
    php version to 4.0.4, beacause of some oci bugs in older versions...

    Warning: Cannot save a lob wich size is less than 1 byte in /projects/Indianguide/public_html/admin/articles/mod.php on line 11

      thanks thomas i got got the solution. i alrady had php4.0.4 when i posted the query.

      but thanks anyways, u gave me another way of looking at it.

        Write a Reply...