本文介绍了将XML从CLOB列转换为XMLType列时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一些来自CLOB的XML数据转换为XMLType列.

I'm trying to convert some XML data coming from a CLOB to a XMLType column.

XML带有一些强调的字符作为值(文档用法语书写).

The XML have some accentuated characters as values (documents are written in french).

这是指令的样子:

insert into mytable (id, xmldata) values (p_id, xmltype(p_xmldata));

p_idp_xmldata是先前从原始表中提取的变量.

p_id and p_xmldata are variables previously extracted from the original table.

我认为法语字符阻止XMLType正常工作.还是格式错误的XML标签?问题是,该表包含3k +个XML文档,而XMLType列中仅转换了2个.

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.

更新:这些是我尝试简单操作时遇到的错误:

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

推荐答案

我使用了createxml方法,现在效果很好

I used createxml method and now it works fine

insert into mytable (id, xmldata) values (p_id, xmltype.createxml(p_xmldata));

这篇关于将XML从CLOB列转换为XMLType列时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 21:07