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: Challenging Question

Re: Challenging Question

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Fri, 17 Sep 2004 14:57:42 -0700
Message-ID: <1095458332.74776@yasure>


Raja Botham wrote:

> Hello All,
> At the moment, I am working on all the old(legacy) scripts in an
> effort to re-engineer and reuse them to acheive the same business
> needs. On one count, I encountered something very challenging that I
> wanted to share so I can know from you as I am clueless how to begin.
>
> Ok, here is the table
>
> Table XX
> ------------
>
> Jan00 Feb00 ... Sep04 Oct04 Nov04 Dec04 Jan05 Feb05 ...... Dec10
> ----- ----- ----- ----- ----- ----- ----- ----- ------
>
>
> I finished develpoing the package that would calculate the periods and
> their amounts,, however, I am stuck at the point where the values are
> assigned to the columns in table XX.
>
> The output of the package is like this:
>
> Period : Sep04
> Amount : 20
>
> Period : Oct04
> Amount : 30
>
> Period : Nov04
> Amount :30
>
> Period : Dec04
> Amount : 20
>
> The above is just an example,, Sometimes the periods and amounts would
> extend up until Dec10 and sometimes it would just be for a month (say,
> Sep05).
>
>
> Now my task is to insert the values(amounts) to the corresponding
> columns in table XX. So, the table XX should appear like this for this
> data.
>
>
> Jan00 Feb00 ... Sep04 Oct04 Nov04 Dec04 Jan05 Feb05 ...... Dec10
> ----- ----- ----- ----- ----- ----- ----- ----- ------
> 20 30 30 30 25
>
>
> How would I do that ?? I tried using types, records, arrays, dynamic
> sql,, but I am not close enough to make it work. Which is why I would
> like to know if there is any recommended way to go about this.
>
> I look forward to responses based on which I would start working on
> it...
>
>
> Thanks
> Raja
>
> Sometimes the

If the challenge is to cross-tabulate ... use DECODE. An example can be found at: http://www.psoug.org
Click on Morgan's Library
Click on DECODE
Search for 'crosstab'

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Fri Sep 17 2004 - 16:57:42 CDT

Original text of this message

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