<?php
// by [email protected]// Use option: OCI_DEFAULT for execute command to delay execution
OCIExecute($stmt, OCI_DEFAULT);// for retrieve data use (after fetch):$result = OCIResult($stmt, $n);
if (is_object ($result)) $result = $result->load();// For INSERT or UPDATE statement use:$sql = "insert into table (field1, field2) values (field1 = 'value',
field2 = empty_clob()) returning field2 into :field2";
OCIParse($conn, $sql);
$clob = OCINewDescriptor($conn, OCI_D_LOB);
OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$clob->save ("some text");
OCICommit($conn);?>
参考上面的代码吧
// by [email protected]// Use option: OCI_DEFAULT for execute command to delay execution
OCIExecute($stmt, OCI_DEFAULT);// for retrieve data use (after fetch):$result = OCIResult($stmt, $n);
if (is_object ($result)) $result = $result->load();// For INSERT or UPDATE statement use:$sql = "insert into table (field1, field2) values (field1 = 'value',
field2 = empty_clob()) returning field2 into :field2";
OCIParse($conn, $sql);
$clob = OCINewDescriptor($conn, OCI_D_LOB);
OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$clob->save ("some text");
OCICommit($conn);?>
参考上面的代码吧
OCINewDescriptor($conn, OCI_D_LOB);了。我使用后代码就出现下面的错误Warning: OCIStmtExecute: ORA-01024: invalid datatype in OCI call in D:\wwwroot\savedoc.php on line 14 // For INSERT or UPDATE statement use:
$sql = "insert into TB_WEB_UNITDOC (N_DOCID, N_UNITID,C_DOCMENT)
values (SEQ_WEB_UNITDOC.NEXTVAL,$dw,C_DOCMENT = empty_clob()) returning C_DOCMENT into :field2";
$stmt = OCIParse($conn, $sql);
$clob = OCINewDescriptor($conn, OCI_D_LOB);
OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$clob->save ("TEST TEST TEST");
OCICommit($conn);