Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Pivot Tables

Re: Pivot Tables

From: <christianboivin_at_my-deja.com>
Date: Fri, 26 Jan 2001 14:24:54 GMT
Message-ID: <94s1bc$n0v$1@nnrp1.deja.com>

In article <3A710F5F.7D9E5D2A_at_exesolutions.com>,   "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote: > > "Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote:
> > > > Can I reference that cursor in a VIEW? Basically I've got a
 situation
> > > > where I need to create a row from columns that I JOIN into
 (based on
> > > > the newly created row) in a VIEW.
> > > >
> > > > In article <94ndst$ook$1_at_nnrp1.deja.com>,
> > > > christianboivin_at_my-deja.com wrote:
> > > > > Hi
> > > > > The better way, i think !
> > > > > is to create a stored proc that return
> > > > > a generic ref cursor ...
> > > > >
> > > > > Regards
> > > > > Chris
> > > > >
> > > > > In article <94ncmc$nj1$1_at_nnrp1.deja.com>,
> > > > > alvie_at_my-deja.com wrote:
> > > > > > Hi
> > > > > > I have a table that looks like this:
> > > > > >
> > > > > > product_id product_name
> > > > > > --------------------------------
> > > > > > 1 item1
> > > > > > 2 item1
> > > > > > 3 item1
> > > > > >
> > > > > > Is there a way using SQL to make it look like this:
> > > > > >
> > > > > > product_name Alias1 Alias2 Alias3
> > > > > > ---------------------------------------------------
> > > > > > item1 1 2 3

> > >
> > > You can pivot Oracle data using the DECODE function.
> > >
> > > Daniel A. Morgan
> > >
> > >
> >
> > Can you post a small exemple of this
>
> Not really what I have is an article written by Joe Celko. The one
 time I
> used it was on a security system where I couldn't keep a copy of the  code.
> Basically all you do is use DECODE and then alias the results to  create the
> new column names.
>
> Daniel A. Morgan
>
>

The only thing i see with the decode
for pivot is that is a Hardcode pivot,
that is,
you have 3 values, then 3 columns, add a column you have to modify your decode,
do you know the query syntax TRANSFORM/PIVOT (cross table query) with ms-access, this one is hard to reproduce with ORACLE. i'll try to find your article

Chris
(sorry if my english is not very good!)

Sent via Deja.com
http://www.deja.com/ Received on Fri Jan 26 2001 - 08:24:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US