string literal too long - how to assign long xml data to clob data type in oracle 11g r2(字符串文字太长 - 如何将长 xml 数据分配给 oracle 11g r2 中的 clob 数据类型)
问题描述
我需要将大约 30,000 行的非常大的 xml 数据分配给 oracle 数据库 11g r2 中的 CLOB 数据类型.我在 Oracle Sql Developer 中使用这个命令.
I need to assign a very large xml data of around 30,000 lines to a CLOB data type in oracle database 11g r2. I am using this command in Oracle Sql Developer.
当我使用以下命令时,首先我会收到 7 次 输入引用值 的提示,然后当语句执行完成时,我得到 - 'string literal too long` 错误.
When I use the following command, at first I get 7 prompts for entering quote value and then when statement execution completes, I get - 'string literal too long` error.
update tablename set columnName = 'large xml data' where id=1;
我在 xml 数据中使用了七个双(单引号)来转义单引号.
I used seven double (single quotes) inside the xml data to escape the single quotes.
如何将这些数据分配到 CLOB 列?
How to assign this data to the CLOB column?
推荐答案
一种方法是使用 sqlldr.首先,创建一个小的保存表:
One approach is to use sqlldr. First, create a small holding table:
create table tstclob
(
id number,
doc clob
);
假设你的大文档是文件c:data est_doc.txt",创建一个sqlldr控制文件(test_doc.ctl")来加载它:
Assuming your large document is the file "c:data est_doc.txt", create a sqlldr control file ("test_doc.ctl") to load it:
load data
infile *
replace
into table tstclob
fields terminated by ','
(
ID char(1),
lob_file FILLER char,
DOC LOBFILE(lob_file) TERMINATED BY EOF
)
begindata
1,c:data est_doc.txt
然后运行 sqlldr(在本例中,从 c:data 目录):
Then run sqlldr (in this case, from c:data directory):
sqlldr control=test_doc.ctl userid=someuser@somedb/somepass
然后您可以使用 tstclob 表更新您想要的任何表.
You can then update whatever table you want using tstclob table.
这篇关于字符串文字太长 - 如何将长 xml 数据分配给 oracle 11g r2 中的 clob 数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:字符串文字太长 - 如何将长 xml 数据分配给 oracle 11g r2 中的 clob 数据类型
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 更改自动增量起始编号? 2021-01-01
