oracle 将 XML 从 CLOB 列转换为 XMLType 列时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1219749/
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
Error when converting XML from a CLOB column to XMLType column
提问by Philippe
I'm trying to convert some XML data coming from a CLOB to a XMLType column.
我正在尝试将来自 CLOB 的一些 XML 数据转换为 XMLType 列。
The XML have some accentuated characters as values (documents are written in french).
XML 有一些强调字符作为值(文档是用法语编写的)。
Here is what the instruction looks like :
这是指令的样子:
insert into mytable (id, xmldata) values (p_id, xmltype(p_xmldata));
p_id
and p_xmldata
are variables previously extracted from the original table.
p_id
和p_xmldata
是先前从原始表中提取的变量。
I think the french characters prevents XMLType to work correctly. Or maybe malformed XML tags? The problem is, the table holds 3k+ XML documents and only 2 are converted in the XMLType column.
我认为法语字符会阻止 XMLType 正常工作。或者格式错误的 XML 标签?问题是,该表包含 3k+ 个 XML 文档,而在 XMLType 列中仅转换了 2 个。
Update:These are the errors I get when I try a simple:
更新:这些是我尝试简单时遇到的错误:
select xmltype(xmldata) from mytable
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.XMLTYPE", line 254
ORA-06512: at line 1
回答by Philippe
I used createxml method and now it works fine
我使用了 createxml 方法,现在它工作正常
insert into mytable (id, xmldata) values (p_id, xmltype.createxml(p_xmldata));