In php + oracle, when the clob field is inserted into a database larger than 4000 bytes, the message "stringliteraltoolong" is returned.

Source: Internet
Author: User
RT, google said that the SQL statement is too long and can be used to bind variables. The project uses yii, so. I use bindParam of yii to solve the error of too long characters, but the new error comes: only the LONG value of the LONG column to be inserted can be bound .. Struggling, asking for help .. RT, google said that the SQL statement is too long and can be used to bind variables. The project uses yii, so. I use bindParam of yii to solve the error of too long characters, but the new error comes: only the LONG value of the LONG column to be inserted can be bound ..
Struggling, asking for help ..

The problem has been disabled. cause:

Reply content:

RT, google said that the SQL statement is too long and can be used to bind variables. The project uses yii, so. I use bindParam of yii to solve the error of too long characters, but the new error comes: only the LONG value of the LONG column to be inserted can be bound ..
Struggling, asking for help ..

Dig graves .. After so long, I accidentally found a solution .. The original Oracle official documentation has a method .. Khan...
Use php_oci8 extension.
During insertion:

$sql = "INSERT INTO mylobs          (id,mylob)        VALUES          (mylobs_id_seq.NEXTVAL,EMPTY_CLOB())       RETURNING          mylob INTO :mylob_loc";$stmt = oci_parse($conn, $sql);$myLOB = oci_new_descriptor($conn, OCI_D_LOB);oci_bind_by_name($stmt, ":mylob_loc", $myLOB, -1, OCI_B_CLOB);oci_execute($stmt, OCI_DEFAULT) or die ("Unable to execute query\n");$myLOB->save('mylob_loc');oci_commit($conn);oci_free_statement($stmt);$myLOB->free();oci_close($conn);

Http://www.oracle.com/technetwork/art...

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.