I have the following error with an INSERT statement with a very large string:
INSERT INTO MYTABLE (CLOB_COLUMN) VALUES ('string longer than 4000 characters');
This returns the following error:
ORA-01704: string literal too long
I've tried even the function TO_CLOB:
INSERT INTO MYTABLE (CLOB_COLUMN) VALUES (TO_CLOB('string longer than 4000 characters'));
The error is the same.
How to insert a large string in a CLOB column without concatenating the string into chunks, avoiding the error ORA-01704?
to_clob('string less') || to_clob(' than 4000 characters'). Or use external program and pass clob as clob. This is described in docs: A text literal can have a maximum length of 4000 bytes if the initialization parameterMAX_STRING_SIZE = STANDARD, and 32767 bytes ifMAX_STRING_SIZE = EXTENDEDDECLARE v_str VARCHAR2(32000) := 'your 32k string'; BEGIN INSERT INTO MYTABLE (CLOB_COLUMN) VALUES (TO_CLOB(v_str)); END;but that just moves the limit from 4k to 32k.INSERT INTO MYTABLE (CLOB_COLUMN) VALUES (:your_bind_variable)or load the value from a file.