请参阅下面的SQL:
select dbms_xmlgen.getxml('select incident_id FROM INCIDENTS where incident_id=600') xml
from dual
它返回:
<?xml version="1.0"?>
<ROWSET>
<ROW>
<INCIDENT_ID>600</INCIDENT_ID>
</ROW>
</ROWSET>
如何排除退回:
<SYSTEM URN="114644">
<INCIDENT_ID>600</INCIDENT_ID>
<SYSTEM>
我想硬编码XML的第一行和第三行。
答案 0 :(得分:1)
使用提取功能获得所需的输出
EXTRACT (XML) is similar to the EXISTSNODE function.
It applies a VARCHAR2 XPath string and returns an XMLType instance containing an XML fragment. You can specify an absolute XPath_string with an initial slash or a relative XPath_string by omitting the initial slash.
If you omit the initial slash, the context of the relative path defaults to the root node...
这里也看到类似的问题 https://community.oracle.com/thread/1126429?tstart=0