1、所有版本的Oracle都可以使用wm_concat()函数:
SELECT pos_preeqid,wmsys.wm_concat(to_char(wkid)) FROM worker where pos_preeqid=62 and wkid<40000 GROUP BY pos_preeqid;
2、如果是11g的话,使用listagg() within group() 函数:
SELECT pos_preeqid, ListAgg(to_char(wkid),',') WITHIN GROUP(ORDER BY pos_preeqid) AS xCity FROM worker where pos_preeqid=62 and wkid<40000 GROUP BY pos_preeqid;