Oracle query using Xpath to get comma separated List for same node
<p><em>Hello Everyone,
I need a help to fetch comma separated list for same node if exists in XML nodes.
My XML is like this which is stored in my database:-</em></p>

<pre><code>&lt;Event&gt;
    &lt;Detail&gt;
        &lt;List&gt;
            &lt;Element&gt;
                &lt;name&gt;ABC&lt;/name&gt;
                &lt;salary&gt;150&lt;/salary&gt;
            &lt;/Element&gt;
            &lt;Element&gt;
                &lt;name&gt;PQR&lt;/name&gt;
                &lt;salary&gt;250&lt;/salary&gt;
            &lt;/Element&gt;
        &lt;/List&gt;
    &lt;/Detail&gt;
&lt;/Event&gt;
</code></pre>

<p><em>I need to get comma separated name list  (ABC,PQR ) from this using xpath oracle query.
I have tried alot and when i get a way like this :-</em></p>

<pre><code>NVL(VALUE (line).EXTRACT ('/Event/Detail/List/Element/name/text()') .getstringval (),'') Name List 
</code></pre>

<p>Then , my output was ABCPQR. </p>

<p>No Space or comma was there. Could anyone please help me out for this .</p>

<p><strong>Expected output is :- ABC,PQR</strong></p>

<p>Thanks in advance :)</p>