I have the below data in a column called "attributes" of a table "data" on Oracle 12c database:
<Attributes>
<Map>
<entry key="accountFlags">
<value>
<List>
<String>Normal User Account</String>
</List>
</value>
</entry>
<entry key="cn" value="paul.john"/>
<entry key="department" value="IT"/>
<entry key="description" value="New account. Automatically created"/>
<entry key="displayName" value="John, Paul"/>
<entry key="distinguishedName" value="CN=paul.john,OU=Users,DC=test,DC=com"/>
<entry key="givenName" value="Paul"/>
<entry key="homeMDB" value="CN=Test,CN=Databases,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=test,DC=com"/>
<entry key="l" value="London"/>
<entry key="mail" value="[email protected]"/>
<entry key="mailNickname" value="PaulJ"/>
<entry key="manager" value="CN=brock.lesnar,OU=Users,DC=test,DC=com"/>
<entry key="memberOf">
<value>
<List>
<String>CN=Test1,OU=Rights,OU=Groups,DC=test,DC=com</String>
<String>CN=Test2,OU=Rights,OU=Groups,DC=test,DC=com</String>
<String>CN=Test3,OU=Rights,OU=Groups,DC=test,DC=com</String>
<String>CN=Test4,OU=Rights,OU=Groups,DC=test,DC=com</String>
</List>
</value>
</entry>
</Map>
</Attributes>
I wish to extract the value of "memberOf" from this column like this:
MEMBER_OF
---------
CN=Test1,OU=Rights,OU=Groups,DC=test,DC=com
CN=Test2,OU=Rights,OU=Groups,DC=test,DC=com
CN=Test3,OU=Rights,OU=Groups,DC=test,DC=com
CN=Test4,OU=Rights,OU=Groups,DC=test,DC=com
I have tried this with the below query which is returning null:
SELECT EXTRACTVALUE(xmltype(attributes), '/Attributes/Map/entry[@key="memberOf"]/value/List/@String')
FROM DATA;
I have also tried the below query which also returns null
SELECT EXTRACTVALUE(xmltype(attributes), '/Attributes/Map/entry[@key="memberOf"]/value[1]/List/@String')
FROM DATA;
Not sure if there is something else that needs to be passed in the query?