1
我有這樣的XML。我無法把它解析爲使用表oracle XML到數據庫表
<REQMST>
<ROW>
<REQ_ID>668 </REQ_ID>
<RequestDetails>
<REQ_DTL_ID>845</REQ_DTL_ID>
<INTERFACE_REFNUM>1</INTERFACE_REFNUM>
</RequestDetails>
<RequestDetails>
<REQ_DTL_ID>846</REQ_DTL_ID>
<INTERFACE_REFNUM>2</INTERFACE_REFNUM>
</RequestDetails>
</ROW>
</REQMST>
我想它解析爲表
select *
FROM XMLTABLE('/REQMST/ROW'
PASSING
xmltype('
<REQMST>
<ROW>
<REQ_ID>668 </REQ_ID>
<RequestDetails>
<REQ_DTL_ID>845</REQ_DTL_ID>
<INTERFACE_REFNUM>1</INTERFACE_REFNUM>
</RequestDetails>
<RequestDetails>
<REQ_DTL_ID>846</REQ_DTL_ID>
<INTERFACE_REFNUM>2</INTERFACE_REFNUM>
</RequestDetails>
</ROW>
</REQMST>')
COLUMNS
--describe columns and path to them:
REQ_ID varchar2(20) PATH './REQ_ID',
REQ_DTL_ID varchar2(20) PATH './RequestDetails/REQ_DTL_ID',
INTERFACE_REFNUM varchar2(20) PATH './RequestDetails/INTERFACE_REFNUM'
) xmlt
;
我收到錯誤ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
它的工作原理,如果只有一個RequestDetails