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!

Trouble using XML Table to Extract Single Piece of Data

User_LT7WCOct 3 2022

Hi, I'm tying to return 605 as an inline view using XMLTable. My table keeps coming back as "-", and not with 605. Anybody know why this is? Thank you!



with
 t as (
  select XMLType(
  '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
   <SOAP-ENV:Body>
      <AddIntegerResponse xmlns="http://tempuri.org">
         <AddIntegerResult>605</AddIntegerResult>
      </AddIntegerResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>') xml_data
from dual
)
select xmlresponse.*
from t
   , XMLTable(
       XMLNamespaces(
	'http://schemas.xmlsoap.org/soap/envelope/' as "SOAP-ENV",
	'http://tempuri.org' as "ds"),
	'/SOAP-ENV:Envelope/SOAP-ENV:Body/ds:AddIntegerResponse/ds:AddIntegerResult'
	passing xml_data
       	columns
	RESULT VARCHAR2(100) path 'ds:AddIntegerResult'
	 ) xmlresponse;
This post has been answered by Hub Tijhuis on Oct 3 2022
Jump to Answer
Comments
Post Details
Added on Oct 3 2022
2 comments
287 views