I have a XMLTYPE with the following content:
<?xml version="1.0"?>
<users>
<user>
<name>user1</name>
</user>
<user>
<name>user2</name>
</user>
<user>
<name>user3</name>
</user>
</users>
How can I loop in PL/SQL through all the elements "user"? Thanks
You can use XQuery. Check out the select statement below. v_xml_doc is the XMLTYPE variable containing the XML data.
How about this:
You can loop through the elements using
EXTRACT
andXMLSequence
(splits the XML into distinct chunks -- here users) like this: