ORA-01461: You can only assign a long value to an insert long column "Workaround

Source: Internet
Author: User
Tags table definition

ORA-01461: You can only assign a long value to an insert long column "Workaround

One of the problems encountered today:

Modify some field data content in a data table directly The Times wrong:

ORA-01461: You can only assign a long value to an insert long column "Workaround

Internet search found the solution is:

Method 1, the database character set should be UTF-8, for UTF-8 or some European character sets, Oracle stores, for a character requires 2 or 3 bytes of storage space, although the table definition is VARCHAR2 (4000), but in fact, the field Data_ Length is twice times or 3 times times longer. In this case, Oracle will treat the data_length length of more than 4000 as long, your table has two such fields, the insertion of data is equivalent to the operation of 2 long fields, so error.

As a workaround: It is recommended to reduce the length of the field or split. Really need, you can use the Clob field type instead.

But my modified data cannot exceed this length, as http://www.blogjava.net/allen-zhe/archive/2008/05/06/198627.html commented on the 1 floor, my length is too small to be the problem at all

This method pass!

Act 2, replace the original drive with the latest Ojdbc14.jar driver for Oracle 10g.

I operate directly in the database, it should be said that these drivers are not used. This method cannot be used in my case.


Ora-01461:can bind a Long value only-insert into a long column development project, today is difficult to issue. When JUnit tests write data to Oracle, it appears: Ora-01461:can bind a Long value only for insert into a long column error, depressed, tried several times to find, Chinese will have this problem, and JSP page lost In the Chinese will not report this error (front is struts). Like MySQL, it is likely that the database character encoding problem, it is doubtful whether the character encoding problem (this kind of thinking does not know how silly), because the project all the code is UTF-8, see the next Oracle is ZHS16GBK. And then just build a GBK project to test, and the result is this problem. Later on the old system of the Classes12.jar Drive test, ^_^, will not, too good. See the next Classes12.jar version is 9.0.2.0.0 and is Classes12.jar uncomfortable, later saw a post, said: With 9 and 10.2 without this problem, I go back to see the issue before the version is 10.1.0.2.0, depressed, with the database is 10.2.0.1.0. Change to 10.2.0.1.0 version now. I didn't pay attention, it took me a few hours today. I always thought that JDBC was the database counterpart.

The corresponding JDBC can be found in the Oracle installation directory Oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar

The problem is finally solved, ^_^

ORA-01461: You can only assign a long value to an insert long column "Workaround

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.