Xmlagg Syntax
The below formula will give you the columns in a row. Rtrim(rtrim(Xmlagg (Xmlelement (e , (C.DESCR) || ', ')).extract ( '//text()' ).GetClobVal() ,' ' ) ,',') SELECT Rtrim(rtrim(Xmlagg (Xmlelement (e , (ETHNIC_GRP_CD) || ', ')).extract ( '//text()' ).GetClobVal() ,' ' ) ,',') FROM ps_divers_ethnic where emplid = '900000026' group by emplid SELECT ETHNIC_GRP_CD FROM PS_DIVERS_ETHNIC WHERE EMPLID = '900000026';