暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle XML解析子标签

ASKTOM 2019-11-12
230

问题描述

嗨,汤姆,
我想在不同的行中获取INQORDERSTAT_SYS的值。现在我只得到第一个值 (ADS)。你能帮忙吗?






ADS


OUS




复制

专家解答

你到底是如何获得价值的?

要提取与行同名的属性,可以使用XMLTable。

这将搜索您提供的路径。然后返回COLUMNS子句中匹配路径的元素的值:

with x as (
select xmltype (
'

  
    
      
      ADS
      
      
      OUS
      
    
  
'
) 
doc
from dual
)
 select inqorderstat_sys 
 from x x, xmltable ( 
   xmlnamespaces (
     'http://schemas.xmlsoap.org/soap/envelope/' as "soapenv",
     'http://www.abc.com/OrderStatus' as "inqorderstatus",
     'http://www.abc.com/9' as "abc",
     'http://www.abc.com' as "abcws",
     'http://www.abc.com/OrderStatus' as "NS2"
   ),
   '/Body/msg_RESPONSE/INQORDERSTAT_RESPONSE_MESSAGE/INQORDERSTAT_INFO'
   passing x.doc 
   columns 
     INQORDERSTAT_SYS varchar2(10) path 'INQORDERSTAT_SYS'
 );

INQORDERSTAT_SYS   
ADS                 
OUS       
复制

文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论