Wednesday, December 2, 2015

ORA-01704: string literal too long

create table test (sno number , textstring clob );

insert into test values(1,'PASTE YOUR STRING HERE');

insert into test values(1,'
                          *
ERROR at line 1:
ORA-01704: string literal too long


Problem
The string you are trying to insert is more than of 4000 char. As SQL datatype Char,Varchar, nvarchar and clob have limit of 4000 chars where as on other hand PLSQL have char limit of 32000

Solution
Use PLSQL to insert long length string


DECLARE
    v_string CLOB;
BEGIN
    v_string := 'PASTE YOUR STRING HERE';

    INSERT INTO test 
VALUES (1, v_string);
END; 
/
PL/SQL procedure successfully completed.

No comments:

Post a Comment

web stats