ORA-01461: Can only assign values to long values inserted into Long Columns

Source: Internet
Author: User

Caused by: Java. SQL. batchupdateexception: ORA-01461: Can only assign values to long values inserted into Long Columns
This error occurs when I load a. xml file on a page of the system.

Cause:

This error is thrown when the length of the inserted data is within 1000 and 2000.

Solution:

Train of Thought: Add spaces to the stored string so that it can exceed 2000 characters in length, but it is only applicable to urgent solutions.
1. First introduce import org. Apache. commons. Lang. stringutils in the. Java file;
2. Add the following judgment in the corresponding method of the. Java file:

// Handle ora-1461 issues (clob length error)
If (XML. Length ()> = 1000 & xml. Length () <= 2000 ){
Xml = stringutils. rightpad (XML, 2008 );
}

 

Related Knowledge:

Long:Variable-length string data with a maximum length of 2 GB. Long has the feature of varchar2 columns. It can store up to one long column in a long table.
Long raw: Variable Length binary data, up to 2 GB
Clob: The character big object clob is used to store single-byte character data
Nclob: Used to store multi-byte character data
Blob: Used to store binary data
Bfile: Binary data stored in the file. The data in this file can only be read-only. However, this file is not included in the database. The bfile field is actually stored in the file system. The field stores the file positioning pointer. bfile is read-only for Oracle and does not participate in transactional control and data recovery.
Among them, clob, nclob, blob are internal lob (large object) types, the maximum is 4 GB, there is no long can only have a column limit. Which data type is the best choice for saving images, text files, and Word files? Blob is the best. Long raw is also good, but long is the type to be discarded by Oracle. Therefore, blob is recommended.

 

Link: http://www.blogjava.net/allen-zhe/archive/2008/05/06/198627.html

 

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.