Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

oracle10g - How to insert/update larger size of data in the Oracle tables?

I want to insert large size of data that character length is more than 10,000. I used CLOB data type to each column. I can't insert/update that large data it shows following error:

ORA-01704: string literal too long

My code

 insert into table1 value(1,'values>10000'); 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You'll have to assign the value to a variable & use the variable to insert the data

DECLARE
    v_long_text CLOB;
BEGIN
    v_long_text := 'your long string of text';

    INSERT INTO table
    VALUES      (1,
                 v_long_text);
END; 

To make it clear: there are limits set to character strings:

you cannot have a string literal over

  • 4000 bytes in SQL
  • 32k in PLSQL

If you want to go above this, you'll have to use bind variables.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...