PHP processes Oracle CLOB instances, oracleclob instance _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP processes Oracle CLOB instances and oracleclob instances. PHP processes Oracle CLOB instances. oracleclob instances this article describes how PHP processes Oracle CLOB. Share it with you for your reference. The specific method is as follows: 1. when writing data, use PHP to process Oracle CLOB instances and oracleclob instances.

This example briefly describes how PHP processes Oracle CLOB. Share it with you for your reference. The specific method is as follows:

1. write data

When PDO preprocessing is used, if bindParam () is used without specifying the data type of the field or execute (), PDO defaults to the string type and limits a default length.

Therefore, bindParam () or bindValue () must be used to store clob fields and specify the string length. for example:

The code is as follows:

$ Pdo-> bindParam (': clobdata', $ clobData, PDO: PARAM_STR, strlen ($ clobData ));

2. read data

The CLOB field value retrieved by PDO is a resource identifier when this field is not empty. if it is null, it is a null string. The data retrieval method is as follows:

The code is as follows:

$ Arr = $ pdo-> fetch ();
Is_resource ($ arr ['clob']) & $ arr ['clob'] = stream_get_contents ($ arr ['clob']);

I hope this article will help you with PHP programming.


Why does php always prompt errors when operating oracle's clob type?

Dude, I also encountered this problem. I solved it with the same solution.
 

How does php read the clob field?

Write Data
When PDO preprocessing is used, if bindParam () is used without specifying the data type of the field or execute (), PDO defaults to the string type and limits a default length.
Therefore, bindParam () or bindValue () must be used to store clob fields and specify the string length, for example, $ pdo-> bindParam (': clobdata', $ clobData, PDO:: PARAM_STR, strlen ($ clobData ));

Read Data
The CLOB field value retrieved by PDO is a resource identifier when this field is not empty. if it is null, it is a null string. The data retrieval method is as follows:
$ Arr = $ pdo-> fetch ();
Is_resource ($ arr ['clob']) & $ arr ['clob'] = stream_get_contents ($ arr ['clob']);

Hope to help you

The example in this article describes how PHP processes Oracle CLOB. Share it with you for your reference. The specific method is as follows: 1. writing data is in use...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.