Skip to Main Content

DevOps, CI/CD and Automation

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!

Extract XML attribute value

NagasFeb 20 2019 — edited Feb 22 2019

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.

This post has been answered by cormaco on Feb 21 2019
Jump to Answer
Comments
Post Details
Added on Feb 20 2019
2 comments
29,098 views