下面的代码很好地适用于非整数。
我有几个带有整数的标签(比如<1>
等<2>
),
SET serveroutput ON
alter session set cursor_sharing = exact;
with xmldata(d) as (select xmltype('<ROWSET><ROW><1>ABC</1></ROW></ROWSET>') from dual
)
select x.*
FROM xmldata,
xmltable('ROWSET/ROW' passing xmldata.d
columns
name varchar2(10) path '1'
) x
;
我也尝试过使用它:
DECLARE
l_xml xmltype;
l_val VARCHAR2(1000) := '<ROWSET><ROW><1>ABC</1></ROW></ROWSET>';
BEGIN
l_xml := xmltype(l_val);
end;
两者都会导致以下错误:
Error report:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00231: invalid character 49 ('1') found in a Name or Nmtoken
Error at line 1
ORA-06512: at "SYS.XMLTYPE", line 310
ORA-06512: at line 5
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.
在此先感谢和赞赏:)