How to insert a CLOB field of over 4000 bytes in Oracle

Source: Internet
Author: User
Tags oracleconnection

Oracle inserts a CLOB field of over 4000 bytes. You can create a separate OracleCommand to insert the specified clob field. Here, we only describe how to insert CLOB data, blob is similar to this. We will not introduce it here. The following two methods are described:
In an application that inserts data using SQL statements in a group, we may encounter the need to insert large data, for example, when we need to insert fields with more than 4000 bytes in oracle, if we use a simple grouping SQL statement to insert the fields, we will obviously encounter problems, this restriction is not imposed on SQL server. I tried to execute a-character SQL statement in SQL server and still can insert data, however, if you insert more than 4000 characters in oracle, an exception is reported. The following is a summary of the solution to this problem: we can create a separate OracleCommand to insert the specified data successfully. Here we only introduce how to insert clob data, blob is similar to this. We will not introduce it here. The following two methods have been verified: string conn = "Data Source = connection string specified by the client; User ID = user; password = mima "; OracleConnection Con = new System. data. oracleClient. oracleConnection (conn); Con. open (); string jsontext = "insert into gwexpointlist (id, name, content) VALUES (1, 'name',: clob)"; OracleCommand cmd = new OracleCommand (jsontext, con); OracleParameter op = new OracleParameter ("clob", OracleType. clob); op. value = "super-normal string with more than 4000 characters"; cmd. parameters. add (op); cmd. executeNonQuery (); Con. close ();
 

Related Article

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.