Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Crosstab-like query or Sybase's LIST function in Oracle ??
Write a small pl/sql function with parameter FLD1 that returns desired list
and use `select fld1, fun(fld1) from crosstab group by fld1'.
monsri_at_my-deja.com wrote:
>
> Hi,
> Did anybody succeed in making a crosstab-like query in Oracle ?
> For ex. if I have the following in my table:
>
> > SQL> break on fld1
> > SQL> select * from crosstab;
> >
> > FLD1 FLD2
> > ---------- ----------
> > 1 11
> > 12
> > 13
> > 14
> > 15
> > 2 21
> > 22
> > 23
> >
> > 8 rows selected.
>
> I'd like to get something looking like:
> > SQL> select fld1, list(fld2) from crosstab [group by fld1];
> >
> > FLD1 FLD2
> > ---------- ------------------
> > 1 11, 12, 13, 14, 15
> > 2 21, 22, 23
> > SQL>
>
> as it's possible to do with Sybase. Did someone ever manage getting
> that kind of stuff either in pure SQL or with a user-defined procedure
> ??
>
> Thanks a lot !!
>
> Spendius
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Tue Sep 07 1999 - 07:50:25 CDT
![]() |
![]() |