Du kan extrahera nodens innehåll med XMLQUERY
:
select xmlquery('declare namespace soapenv = "http://schemas.xmlsoap.org/soap/envelope/";
declare namespace urn = "urn:ABC";
/soapenv:Envelope/soapenv:Body/urn:settleResponse/settleReturn/message/text()'
passing XMLType(message)
returning content) as message,
xmlquery('declare namespace soapenv = "http://schemas.xmlsoap.org/soap/envelope/";
declare namespace urn = "urn:ABC";
/soapenv:Envelope/soapenv:Body/urn:settleResponse/settleReturn/errorCode/text()'
passing XMLType(message)
returning content) as errorCode,
xmlquery('declare namespace soapenv = "http://schemas.xmlsoap.org/soap/envelope/";
declare namespace urn = "urn:ABC";
/soapenv:Envelope/soapenv:Body/urn:settleResponse/settleReturn/status/text()'
passing XMLType(message)
returning content) as status
from external;
MESSAGE ERRORCODE STATUS
-------------------- -------------------- ----------
Missing first name INVALID_ACC Failed
Eller kanske enklare, särskilt om du har flera meddelanden att hantera, med XMLTABLE
:
select x.*
from external ext
cross join xmltable(
xmlnamespaces('http://schemas.xmlsoap.org/soap/envelope/' as "soapenv",
'urn:ABC' as "urn"),
'/soapenv:Envelope/soapenv:Body/urn:settleResponse/settleReturn'
passing XMLType(ext.message)
columns message varchar2(20) path 'message',
errorCode varchar2(20) path 'errorCode',
status varchar2(10) path 'status'
) x;
MESSAGE ERRORCODE STATUS
-------------------- -------------------- ----------
Missing first name INVALID_ACC Failed
I båda fallen måste du ange namnområdena, och syntaxen är annorlunda. Läs mer om hur du använder dessa funktioner .
Du kan infoga dessa direkt i en annan tabell med insert into some_table (x, y, z) select ...
.