Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when converting XML from a CLOB column to XMLType column

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

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

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.

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
like image 267
Philippe Avatar asked Aug 14 '26 11:08

Philippe


1 Answers

I used createxml method and now it works fine

insert into mytable (id, xmldata) values (p_id, xmltype.createxml(p_xmldata));
like image 65
Philippe Avatar answered Aug 18 '26 01:08

Philippe