达令说
方法一,使用connect by +sys_connect_by_path :--测试数据create table test(col varchar2(10));insert into test values('a');insert into test values('b');insert into test values('c');--SQL语句:select ltrim(sys_connect_by_path(col, ','), ',')from (select col, row_number() over(order by rownum) rn from test t)where connect_by_isleaf = 1start with rn = 1connect by rn = prior rn + 1;方法二,使用xmltype:select dbms_lob.substr(rtrim(xmlagg(xmlparse(content col || ',' wellformed)).getclobval(),','),4000,1)from test;另外在10,11版本中也不建议使用wm_concat,这个函数属于非公开函数,在12c版本中已经失效;