How to display multiple records in a single row [message #644826] |
Wed, 18 November 2015 07:59  |
 |
subash141
Messages: 2 Registered: November 2015
|
Junior Member |
|
|
Hi All,
I am trying to display multiple row values in a single row.
I am trying with the below syntax ...
select deptno
, ltrim(sys_connect_by_path(ename,','))
from ( select deptno
, ename
, row_number() over (partition by deptno order by ename) -1 as seq
from emp )
where connect_by_isleaf = 1
connect by seq = prior seq +1 and deptno = prior deptno
start with seq = 1;
Expected output
DEPTNO CONCATENATED
---------- --------------------------------------------------
10 CLARK,KING,MILLER
20 ADAMS,FORD,JONES,SCOTT,SMITH
30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
But when i try with the above syntax i am getting "ora-01489 result of string concatenation is too long" error.
Please help me in this issue, its urgent.
Thanks,
Subash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|