Working with very large text data and CLOB column(处理非常大的文本数据和 CLOB 列)
问题描述
根据文档 CLOB 和 NCLOB数据类型列,最多可存储 8 TB 的字符数据.
According to documentation CLOB and NCLOB datatype columns, can store up to 8 terabytes of character data.
我有包含 100 000 个字符的文本,我该如何运行这样的查询:
I have text, which contains 100 000 character, how can I run query like this:
UPDATE my_table SET clob_column = 'text, which contains 100 000 characters'
WHERE id = 1
?
如果在文本中,字符数高达 32767,则可以使用 PL/SQL 匿名块:
If in text, character count is up to 32767, there is possible to use PL/SQL anonymous block:
DECLARE
myvar VARCHAR2(15000);
BEGIN
myvar := 'text, which contains 100 000 characters';
UPDATE my_table SET clob_column = myvar
WHERE id = 1;
....
END;
文本非常大并且包含例如 100 000 个字符的解决方案是什么?
What is solution, where text is very large and contains for example 100 000 characters ?
更新
我正在尝试使用 dbms_lob.append:
create table t1 (c clob);
declare
c1 clob;
c2 clob;
begin
c1 := 'abc';
c2 := 'text, which contains 100 000 characters';
dbms_lob.append(c1, c2);
insert into t1 values (c1);
end;
虽然,也有错误:string literal too long.
我做错了什么?
推荐答案
你应该使用dbms_lob包,添加一些字符串到clob的过程是dbms_lob.append.
You should use the dbms_lob package, the procedure to add some string to the clob is dbms_lob.append.
DBMS_LOB 文档
declare
c1 clob;
c2 varchar2(32000);
begin
c1 := 'abc';
c2 := 'text, which contains 32 000 characters';
dbms_lob.append(c1, c2);
c2 := 'some more text, which contains 32 000 characters';
dbms_lob.append(c1, c2);
insert into t1 values (c1);
end;
这篇关于处理非常大的文本数据和 CLOB 列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:处理非常大的文本数据和 CLOB 列
基础教程推荐
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
