Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Creating view with variable columns
Hello,
I'm trying to implement the following:
Every 1st day of the month a run should create a view with statistics from a
table with an overview of the past 12 months. I can create this view where
the lay-out (of the columns) it looks like:
field1 field2 jan feb mar apr ... dec.
Only when the view is created in f.e. april, the statistics from January to March are from 2002, where the statistics from months April to December contain info from 2001.
Another option is to create the view with the following format:
field1 field2 mnd mnd1 mnd2 ... mnd11
where mnd should read the last month, mnd1 the previous month etc. With a select-statement querying this view I can get the results I want, reading
field1 field2 dec nov oct ... jan
when it's run in January.
My question is, is it in one way or another possible to create this view 'immediately' with columnnames including the names of months, so that when the view is created in June, it reads
field1 field2 may apr ... jun
If so, what should I do to solve this 'problem' ?
I've searched via google but didn't come up with something which could solve the above.
With kind regards,
Dick
Received on Wed Jan 16 2002 - 08:09:00 CST