I have a table with column name message
which is of type NCLOB and ID
which is of type varchar2
I want to update the message of a particlular ID. I am using the following query
update table_name set message='<<long XML Message>>' where ID=value
I am getting the following error :
Error at Command Line:6 Column:38
Error report:
SQL Error: ORA-01704: string literal too long
01704. 00000 - "string literal too long"
*Cause: The string literal is longer than 4000 characters.
*Action: Use a string literal of at most 4000 characters.
Longer values may only be entered using bind variables.
I tried storing the xml into a variable and updating the column to this variable, but of no use
Oracle has a limit on the length of literal strings, you are hitting that limit. You can break it up into 4000 character chunks. This might do it for you. I can't test it at the moment.
update table_name set message= '<4K>' || '<4K>' || '<4K>' where ID=value
It looks like the above will not work.
So lets try this, with 1K blocks:
update table_name set message= '<1st 1K>' where ID=value;
update table_name set message= message || '<2nd 1K>' where ID=value;
update table_name set message= message || '<3rd 1K>' where ID=value;
update table_name set message= message || '<4th 1K>' where ID=value;
I was able to add a message length of 80K. I just stopped after that, no errors.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.