Oracle Query Query to Join two tables, If there are multiple values in single cell that we need put "on" condition. select rtrim(xmlagg (xmlelement (e, RelationshipName|| ',')).extract ('//text()'), ',') from Relationship WHERE ID IN ( SELECT distinct val FROM Person reln1 ,XMLTABLE('/ol/li/text()'PASSING xmltype(' &ltol&gt &ltli&gt ' || REPLACE (reln1.RelationshipId, ',', ' &lt/li&gt &ltli&gt ') || ' &lt/li&gt &lt/ol&gt ') COLUMNS val varchar2(10) PATH '/'))