Just see the sample code below. Hope you will understand :
<?php
$conn = ocilogon("scott","tiger");
// create table
$stmt = ociparse($conn,"create table test (id number, clob clob)");
ociexecute($stmt);
ocifreestatement($stmt);
// insert two rows
$clob = ocinewdescriptor($conn,OCI_D_LO😎;
$stmt = ociparse($conn,"insert into test (id,clob) values (:id,EMPTY_CLOB())
returning clob into :clob");
ocibindbyname($stmt,":id",&$id,32);
ocibindbyname($stmt,":clob",&$clob,-1,OCI_B_CLO😎;
$id = 10;
ociexecute($stmt,OCI_DEFAULT);
$clob->save("hi, this would be my binary or whatsoever data!");
$id = 20;
ociexecute($stmt,OCI_DEFAULT);
$clob->save("hi, this would be my second binary or whatsoever data!");
ocifreedescriptor($clob);
ocifreestatement($stmt);
// SELECT with "inlined" LOBS
$stmt = ociparse($conn,"select * from test");
ociexecute($stmt,OCI_DEFAULT);
while (ocifetchinto($stmt,&$arr,OCI_RETURN_LOBS)) {
var_dump($arr);
}
ocifreestatement($stmt);
// SELECT and update the lob....
$stmt = ociparse($conn,"select * from test");
ociexecute($stmt,OCI_DEFAULT);
while (ocifetchinto($stmt,&$arr,OCI_ASSOC)) {
var_dump($arr);
$lob = $arr[ "CLOB" ]->load();
$arr[ "CLOB" ]->load($lob . "saved again");
}
ocifreestatement($stmt);
// DROP TABLE
$stmt = ociparse($conn,"drop table test");
ociexecute($stmt);
ocifreestatement($stmt);
ocilogoff($conn);
?>