Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Concatenate Column Values from Multiple Rows into a Single Column
"Rad Thibodayox" <cdt1968RemoveThis_at_hotmail.com> wrote in message
news:3fd08a6c$1_2_at_news.unc.edu...
>
>
> Daniel Morgan wrote:
> > Rad Thibodayox wrote:
> >
> >> I would like to combine a field's values from multiple records in a
> >> single field. For example:
> >>
> >> Last First Code
> >> ------- --------- ----
> >> Lesand Danny 1
> >> Lesand Danny 2
> >> Lesand Danny 3
> >> Benedi Eric 7
> >> Benedi Eric 14
> >>
> >> Result should look like:
> >>
> >> Last First Codes
> >> ------- --------- -----
> >> Lesand Danny 1,2,3
> >> Benedi Eric 7,14
> >>
> >>
> >> Any help would be appreciated,
> >>
> >> Dwayne
> >
> >
> > This is school work and as you can probably surmise we don't do other
> > people's homework and exams.
> >
> > But you are entitled to a hint ... and the hint is that this requires a
> > stored procedure. Think cursor. Think loop.
> >
> Hey Jackass,
>
> You surmised wrong. I'm a SAS programer new to Oracle. This kind of
> thing can be done in a frigging data step in SAS. I just figured Oracle
> could handle it as easily.
>
> Thanks for Nothing Jerk
>
Hi Dwayne,
I'm also a SAS programmer and currently teaching myself PL/SQL which is what
you will need in this case, Oracle SQL wont do here. Seeing that you are new
to Oracle my advise to you is :
extract your data from Oracle into a SAS dataset then do your manipulation
in SAS using the data step. Otherwise if you decide to write a procedure for
it then you may want to look at CURSORs, FOR LOOPS, INDEX BY Table with
PRIOR and NEXT methods etc.