how to update a LOB with PHP in oracle? (OCI_INVALID_HANDLE) -
i'm trying update (c)lob in same way insert. (insert working).
$queryhandle = oci_parse($dbhandle, "update mytable set "myclob" = empty_clob() , "othercol" = :col0 "pkidcol" = :wherecol0 returning "othercol" , "myclob", :retcol0 , :retcol1"); if(!is_resource($queryhandle)) { $error=oci_error($dbhandle); die($error['message'], $error['code']); } oci_bind_by_name($queryhandle, ":col0", $othercolvalue); oci_bind_by_name($queryhandle, ":wherecol0", $pkidcol); oci_bind_by_name($queryhandle, ":retcol0", $retcol1, 100); $lob=oci_new_descriptor($dbhandle); oci_bind_by_name($queryhandle, ":retcol1", $lob, -1, sqlt_clob); if(!oci_execute($queryhandle , oci_no_auto_commit)) { $error=oci_error($dbhandle); die($error['message'], $error['code']); } $lob->save($mylobvalue); // gives php warning: oci-lob::save(): oci_invalid_handle in file.php on line 123 this not update lob , gives an: php warning: oci-lob::save(): oci_invalid_handle in file.php on line 123
there dozens of examples of how insert/update row lob value.
first of all, have create lob descriptor:
$desc = oci_new_descriptor($connection, oci_dtype_lob); then use descriptor binding value lob placeholder:
oci_bind_by_name($queryhandle, ":retcol1", $desc, -1, sqlt_clob); then temporary write data:
$desc->writetemporary($data); and after execute query...
more information find @ documentation + read comments more examples!
some examples uses $desc->write($data); + execute + commit, uses execute + $desc->savefile($data); + commit, should work.
Comments
Post a Comment