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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

wm_concat and order

719215Nov 3 2009 — edited Nov 4 2009
When ran the following query, I got the enames with unordered result . Does anyone know how to get the wm_concat column to order\sort ? I use oracle v10 . Any thoughts are appreciated.Thanks.

select distinct deptno ,wm_concat(ename) over ( partition by deptno order by deptno ) as enames
from emp
group by deptno,ename
order by deptno

current output:
DEPTNO ENAMES 
10	MILLER,CLARK,KING 
20 	SCOTT,JONES,FORD,ADAMS,SMITH 
30	MARTIN,JAMES,WARD,ALLEN,TURNER,BLAKE 
Target output:
DEPTNO ENAMES 
10	CLARK,KING,MILLER 
20 	ADAMS,FORD,JONES,SCOTT,SMITH 
30	ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
Wanwan
This post has been answered by Karthick2003 on Nov 3 2009
Jump to Answer

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 2 2009
Added on Nov 3 2009
16 comments
5,712 views