oracle中的wm_concat

wmsys.wm_concat这个函数,它的作用是以','链接字符。
SQL> select * from idtable;

        ID NAME
---------- ------------------------------
        10 ab
        10 bc
        10 cd
        20 hi
        20 ij
        20 mn

6 rows selected
SQL> select id,wmsys.wm_concat(name) name from idtable
  2  group by id;

        ID NAME
---------- --------------------------------------------------------------------------------
        10 ab,bc,cd
        20 hi,ij,mn

这样在遇到某些需要行列转换的情况时候,就可以不必自己写函数。

猜你喜欢

转载自25262875qq.iteye.com/blog/1812771