// connect to oracle require __SITEROOT."config/oracleConfig.php"; $conn = oci_connect($databaseConfig[__INTERFACE]['user'],$databaseConfig[__INTERFACE]['password'],$databaseConfig[__INTERFACE]['host']); if($format=='xml') { $stmt = oci_parse($conn,"INSERT INTO api_data_xml(uuid,suuid,original_type,original_xml) VALUES ('$api_data_uuid','$summary_uuid',1, EMPTY_BLOB()) RETURNING original_xml INTO :tex_blob"); } if($format=='json') { $stmt = oci_parse($conn,"INSERT INTO api_data_xml(uuid,suuid,original_type,original_json) VALUES ('$api_data_uuid','$summary_uuid',2, EMPTY_BLOB()) RETURNING original_json INTO :tex_blob"); } $clob = oci_new_descriptor($conn,OCI_D_LOB); oci_bind_by_name($stmt,':tex_blob',$clob,-1, OCI_B_BLOB); oci_execute($stmt,OCI_DEFAULT); //这个save要写到oci_execute后面,手册上的例子都是错误的 $clob->save($xml); oci_commit($conn); $clob->free(); oci_free_statement($stmt);
------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------
转载请注明本文标题和链接:《贴一段php使用Oracle把字符串写入blob字段的代码。》
发表评论