2016-07-29 8 views
0

Oracle表のCLOB列に存在するXMLを解析しようとしていますが、nullを戻しています。OracleでExtractvalueを使用してXMLを解析するとNULLが返される

ElementValue=36を以下のXMLから取得しようとしています。

お知らせください。解析に使用

<?xml version="1.0" encoding="iso-8859-1"?> 
<AttributeContent xmlns="urn:schemas.td.com/ENT/AttributeContent" xmlns:xsdi="http://www.w3.org/2001/XMLSchema-instance" xsdi:schemaLocation="urn:schemas.td.com/ENT/AttributeContent/AttributeContent.xsd"> 
    <ContentElements> 
    <ElementName>value</ElementName> 
    <ElementValue>36</ElementValue> 
    </ContentElements> 
    <ContentElements> 
    <ElementName>flag</ElementName> 
    <ElementValue>Y</ElementValue> 
    </ContentElements> 
</AttributeContent> 

SQL:

SELECT EXTRACTVALUE(xmltype(ATTRIBUTE_CONTENT),'/AttributeContent/ContentElements/Elementvalue[1]') 
-- INTO l_batchCycle  
FROM fea_com_ctrl.control_attribute 
WHERE attribute_name = 'BATCH_CYCLE' 
and  end_date is null; 

表の定義:

ATTRIBUTE_NAME VARCHAR2(30 BYTE) 
EFFECTIVE_DATE DATE 
END_DATE DATE 
ATTRIBUTE_CONTENT CLOB 

答えて

1

この

EXTRACTVALUE(
       xmltype(ATTRIBUTE_CONTENT), 
       '/AttributeContent/ContentElements[1]/ElementValue', 
       'xmlns="urn:schemas.td.com/ENT/AttributeContent"') 
をお試しください
関連する問題