When I try to query objects, I end up with following error:
ORA-01461: can bind a LONG value only for insert into a LONG column
Could someone please help me on the cause and solution of the problem?
In SQL the max length of a VARCHAR2 is 4000 bytes; not characters but bytes. Anything longer than 4000 bytes would probably be considered a LONG in the generic sense. means you are trying to 'bind a LONG value' to a VARCHAR2 column and you cannot you can 'bind a LONG value only for insert into a LONG column'.
Answer: The LONG and LONG RAW datatypes have been deprecated and the easiest solution to the ORA-01461 error is to change the column datatype to as CLOB. The replier suggested that instead of using LONG as the column, that ORA-01461 could be avoided if the binary stream was LONG RAW instead.
The LONG datatype can store variable-length character data containing up to two gigabytes of information. The length of LONG values might be limited by the memory available on your computer. You can use columns defined as LONG in SELECT lists, SET clauses of UPDATE statements, and VALUES clauses of INSERT statements.
It can also happen with varchar2 columns. This is pretty reproducible with PreparedStatements through JDBC by simply
So as above said it can be wrong with types, or column width exceeded.
Also note that as varchar2 allows 4k chars max, the real limit will be 2k for double byte chars
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With