如何在 Oracle 表中插入/更新更大的数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8801814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:49:56  来源:igfitidea点击:

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

oracleoracle10gclob

提问by Manohar Kulanthai vel

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:

我想插入字符长度超过 10,000 的大数据。我对每一列都使用了 CLOB 数据类型。我无法插入/更新它显示以下错误的大数据:

ORA-01704: string literal too long

My code

我的代码

 insert into table1 value(1,'values>10000'); 

回答by Sathyajith Bhat

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
  • SQL 中的 4000 字节
  • 32k PLSQL

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

如果你想超越这个,你将不得不使用绑定变量。