这里介绍两种方法:
一、
select t.sex,wmsys.wm_concat(t.sname)from t_student tgroup by t.sex
wm_concat出现在oracle10g版本中,10g以前的版本不能使用,如果合并行数超过4000行也不能使用。
二、
SELECT LISTAGG(to_char(ouname), '/') WITHIN GROUP (order by level) from Table
Oracle11.2新增了LISTAGG函数,可以用于字符串聚集