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!

XML extraction error

kaericnMay 2 2019 — edited May 6 2019

Dear community,

We got the below error

Is there a way I can ignore the error for the XML file get errors while parsing.

As we are on a ready-only-standby and create any table.

1.How do we track this error similar to dbms_errlog in this situation.

2.Is there a way to get around this as our XML file has international character set.

The below sql is a sample which DOES NOT produce the error.

we try to copy and paste foreign character set for google translate with the below sample but no luck yet...

ORA-31011: XML parsing failed

ORA-19213: error occurred in XML processing at lines 70

LPX-00217: invalid character 15573181 (U+EDA0BD)

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.

with xml_str as (   

select '<?xml version = ''1.0'' encoding = ''UTF-8''?>   

<EVENT spec="IDL:com/sapamr_rfcevents/RfcCallEvents:1.0#Z_BAPI_UPDT_SERV_NOTIFICATION">   

   <eventHeader>   

      <objectName/>   

      <objectKey/>   

      <eventName/>   

      <eventId/>   

   </eventHeader>   

   <TAB_DETAIL_DATA>   

      <ZNEWFLAG>X</ZNEWFLAG>   

      <FENUM>2</FENUM>   

      <BAUTL>661-01727</BAUTL>   

      <OTEIL/>   

      <FECOD>KBB</FECOD>   

      <URCOD>B08</URCOD>   

      <ZCOMPMDF>A</ZCOMPMDF>   

      <ZOPREPL/>   

      <ZWRNCOV>LP</ZWRNCOV>   

      <ZWRNREF/>   

      <ZNEWPS>C07XMAAEJCLD</ZNEWPS>   

      <ZOLDPN/>   

      <ZOLDPD/>   

      <ZOLDPS>C07XMAACJCLD</ZOLDPS>   

      <MAILINFECOD/>   

      <ZUNITPR/>   

      <ZNEWPD/>   

      <ZNEWPN/>   

      <ZABUSE/>   

      <ZRPS>S</ZRPS>   

      <ZEXKGB/>   

      <ZKGBMM/>   

      <ZINSTS>000</ZINSTS>   

      <ZACKBB/>   

      <ZCHKOVR/>   

      <ZSNDB/>   

      <ZNOTAFISCAL/>   

      <ZCONSGMT/>   

      <ZPRTCONS/>   

      <ZZRTNTRNO/>   

      <ZZRTNCAR/>   

      <ZZINSPECT/>   

      <ZZPR_OPT/>   

   </TAB_DETAIL_DATA>   

   <TAB_DETAIL_DATA>   

      <ZNEWFLAG>X</ZNEWFLAG>   

      <FENUM>1</FENUM>   

      <BAUTL>661-01727</BAUTL>   

      <OTEIL/>   

      <FECOD>KBB</FECOD>   

      <URCOD>B08</URCOD>   

      <ZCOMPMDF>A</ZCOMPMDF>   

      <ZOPREPL/>   

      <ZWRNCOV>LP</ZWRNCOV>   

      <ZWRNREF/>   

      <ZNEWPS>C07XMAAEJCLD</ZNEWPS>   

      <ZOLDPN/>   

      <ZOLDPD/>   

      <ZOLDPS>C07XMAACJCLD</ZOLDPS>   

      <MAILINFECOD/>   

      <ZUNITPR/>   

      <ZNEWPD/>   

      <ZNEWPN/>   

      <ZABUSE/>   

      <ZRPS>S</ZRPS>   

      <ZEXKGB/>   

      <ZKGBMM/>   

      <ZINSTS>000</ZINSTS>   

      <ZACKBB/>   

      <ZCHKOVR/>   

      <ZSNDB/>   

      <ZNOTAFISCAL/>   

      <ZCONSGMT/>   

      <ZPRTCONS/>   

      <ZZRTNTRNO/>   

      <ZZRTNCAR/>   

      <ZZINSPECT/>   

      <ZZPR_OPT/>   

   </TAB_DETAIL_DATA>   

   <TAB_HEADER_DATA>   

      <QMNUM>030334920069</QMNUM>   

      <ZGSXREF>CONSUMER</ZGSXREF>   

      <ZVANTREF>G338005317</ZVANTREF>   

      <ZSHIPER/>   

      <ZSHPRNO/>   

      <ZRVREF/>   

      <ZTECHID>4HQ2OD6C19</ZTECHID>   

      <ZADREPAIR/>   

      <ZZKATR7/>   

   </TAB_HEADER_DATA>   

</EVENT>   

' as xml_txt   

from dual   

)   

--select * from xml_str;   

SELECT xml_fields.*, xml_str.* 

FROM xml_str, 

       xmltable('/EVENT/TAB_DETAIL_DATA' 

                passing xmltype(xml_str.xml_txt) 

                columns 

                  ZNEWFLAG    varchar2(100) path 'ZNEWFLAG', 

                  FENUM    varchar2(100) path 'FENUM', 

                  BAUTL varchar2(100) path 'BAUTL' 

               ) xml_fields;

This post has been answered by Paulzip on May 2 2019
Jump to Answer
Comments
Post Details
Added on May 2 2019
6 comments
1,297 views