I have table structure like below
create table emp ( empno number,dept_no varchar(4));
insert into emp VALUES (1,'A');
insert into emp VALUES (1,'B');
insert into emp VALUES (1,'C');
insert into emp VALUES (1,'D');
insert into emp VALUES (2,'P');
insert into emp VALUES (2,'Q');
insert into emp VALUES (2,'R');
insert into emp VALUES (2,'S');
I need output like below
1, A
1, A,B
1, A,B,C
1, A,B,C,D
2, P
2, P,Q
2, P,Q,R
2, P,Q,R,S
I am able to achieve this using PL/SQL Block, however is there any possibility we can achieve this through sql?