While I try to set the value of over 4000 characters on a field that has data type CLOB
, it gives me this error :
ORA-01704: string literal too long.
Any suggestion, which data type would be applicable for me if I have to set value of unlimited characters although for my case, it happens to be of about 15000
chars.
Note : The long string that I am trying to store is encoded in ANSI.
This ORA-01704 error is related with the string literal is longer than 4000 characters. Use a string literal of at most 4000 characters. Longer values may only be entered using bind variables. You need to split the characters into multiple parts as follows.
For strings greater than 4000 use a CLOB. you can use CLOB column.
What are you using when operate with CLOB?
In all events you can do it with PL/SQL
DECLARE str varchar2(32767); BEGIN str := 'Very-very-...-very-very-very-very-very-very long string value'; update t1 set col1 = str; END; /
Proof link on SQLFiddle
Try to split the characters into multiple chunks like the query below and try:
Insert into table (clob_column) values ( to_clob( 'chunk 1' ) || to_clob( 'chunk 2' ) );
It worked for me.
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