Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to fix XMLTYPE invalid character error?

AllenS.Mar 7 2023 — edited Mar 8 2023

Hi,

We are getting xml data as file from external sources and importing this in our Oracle Database by reading the file via bfilename. We received a data that has an invalid character which caused an error. A sample data screenshot is shown below.

Converting this to XMLTYPE after reading the file as CLOB returns the following error.

ORA-31011: XML parsing failed
ORA-19213: error occurred in XML processing at lines 5
LPX-00217: invalid character 15712190 (U+EFBFBE)
ORA-06512: at "SYS.XMLTYPE", line 272
ORA-06512: at line 1
31011. 00000 - "XML parsing failed"
*Cause: XML parser returned an error while trying to parse the document.
*Action: Check if the document to be parsed is valid.

Is there a way to fix this?

Correction on my original post: We are using bfilename to open the file instead of utl_file package (which I originally stated). Not sure if it makes a difference.

Comments
Post Details
Added on Mar 7 2023
6 comments
2,857 views