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!

Concatenate multiple columns into one string

mail8mzDec 5 2012 — edited Dec 5 2012
Hello,

I am using Oracle 11.2, how can I concatenate the value of multiple columns into one string with one SQL:

create table testTb(classId number(5), classRoom varchar2(32));

insert into testTb value(101, 'room101');
insert into testTb value(101, 'room201');
insert into testTb value(101, 'room301');
insert into testTb value(202, 'room444');
insert into testTb value(202, 'room555');

I would like to generate the result as followings:

Class 101 is in room101, room201, room301
Class 202 is in room444, room555

Thanks,
This post has been answered by Hoek on Dec 5 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2013
Added on Dec 5 2012
2 comments
3,322 views