Hi,

I get the following error when I try and write to the database on only
some of the items in $res. The majority go in fine. When I enter the
ones causing an error, individually, they go in without a problem.  Is
it because I'm using a loop to enter the data? Can anyone help please?

Thanks in advance,

Simon.


Error:
Warning: OCIStmtExecute: ORA-01704: string literal too long

Code:
while ( list($k, $v) = each($res) )
{
    $body = $res[$k][1];
    $id = $res[$k][0];
    $body = preg_replace( "/'/", "''", $body );
    $sql = "update story
            set body = '$body'
            where id = $id returning body into :body";

    $stmt = OCIParse($db->conn, $sql);
    $lob = OCINewDescriptor($db->conn, OCI_D_LOB);
    OCIBindByName($stmt, ":body" , &$lob, -1, OCI_B_CLOB);
    OCIExecute($stmt, OCI_DEFAULT);
    $body = preg_replace( "/''/", "'", $body );
    if ( $lob->save ("$body") )
    {
        echo "$id written to database<BR>\n";
    }

    OCICommit($db->conn);
    OCIFreeStatement($stmt);
    OCIFreeDesc($lob);
}

--

Simon Pospisil                          Mail:  [EMAIL PROTECTED]
Web Engineer                            Web:   http://www.fastsearch.com/
Fast Web Media Ltd.                     Phone: +44 (0) 161 835 3444
Suite 1202, Sunlight House Quay Street  Fax:   +44 (0) 161 835 3488
Manchester, England M3 3JZ

Try FAST Search: http://www.alltheweb.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to