Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

select using XMLAGG function cutting off the string

user12236189May 16 2012 — edited Sep 3 2013
Hello,


I have string "Oracle & Oracle", when run thru the following statement I am getting &amp as not full string,
how to avoid this and to get the right values


SQL> select col1 from t;

COL1
----------------------------------------------------------------------------------------------------
SQL & SQL
Test & Test
Oracle & Oracle

SQL> select
  2  RTRIM (XMLAGG (XMLELEMENT (E,XMLATTRIBUTES (col1|| ',' AS "Seg"))ORDER BY col1 ASC).EXTRACT ('./E[not(@Seg = preceding-sibling::E/@Seg)]/@Seg'),',') col1
  3  from t;

COL1
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Oracle & Oracle,SQL & SQL,Test & Test
The expected output is
COL1
-------------------------------------
Oracle & Oracle,SQL & SQL,Test & Test
Any help would be greatly appreciated

Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2013
Added on May 16 2012
6 comments
5,228 views