2 Replies Latest reply on Feb 22, 2019 11:15 AM by Nagas

    Extract XML attribute value

    Nagas

      We have a XML clob column and XML stored inside it. We have something like this, We would like to extract the value "28" from <TypeValue days="28" />

       

       

       

      <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
      <InstanceName>
          <PromotionInstance>
       <Cycle>
                      <Type>
                          <TypeValue days="28"/>
                      </Type>
                  </Cycle>
       </PromotionInstance>
      </InstanceName>
      

          

       

      SELECT EXTRACTVALUE(
               XMLTYPE( Clob_Val ),
               '//Instance_Name/PromotionInstance/Cycle/Type/TypeValue[@days]'
             )
      FROM   testTable
      

       

      The Query doesnt return any value, i am quite new XML extraction, hence would like to know the experts advice here. Thanks in Advance.