Home > Article > Backend Development > PHP handles Oracle's CLOB instance, oracleclob instance_PHP tutorial
The example in this article briefly describes how PHP handles Oracle's CLOB. Share it with everyone for your reference. The specific method is as follows:
1. Write data
When using PDO's preprocessing method, if you use bindParam(), etc. without specifying the data type of the field or use execute(), PDO will default to string type and limit a default length
So when storing clob type fields, you must use bindParam() or bindValue(), etc., and specify the string length, for example:
2. Read data
The CLOB field value retrieved by PDO is a resource identifier when the field is not empty, and an empty string when it is empty. The method of obtaining data is as follows
I hope this article will be helpful to everyone’s PHP programming design.
Brother, I also encountered such a problem, please help me solve it and let me know if it is solved
Writing data
When using the preprocessing method of PDO, if you use bindParam(), etc. without specifying the data type of the field or using execute(), PDO will default to the string type and limit a default length
so When storing clob type fields, you must use bindParam() or bindValue(), etc., and specify the string length, for example $pdo -> bindParam(':clobData', $clobData, PDO::PARAM_STR,strlen($clobData)) ;
Read data
The CLOB field value taken out by PDO is a resource identifier when the field is not empty, and an empty string when it is empty. The method of getting the data is as follows
$arr = $ pdo -> fetch();
is_resource($arr['clob']) && $arr['clob'] =stream_get_contents($arr['clob']);
Hope this helps To you