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: CONSECUTIVE Values

Re: CONSECUTIVE Values

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: 18 Nov 2003 21:47:39 -0800
Message-ID: <1a75df45.0311182147.2c002637@posting.google.com>


"Robert C" <rchin_at_panix.com> wrote

> SQL> select MIN(c_year), MAX(c_year)
> 2 from T
> 3 ;
>
> MIN(C_YEAR) MAX(C_YEAR)
> --------------------------- -----------------------------------------------
> -
> 1996 2005
>
> There may be gaps in this column value...
> How can I ensure to return a result of CONSECUTIVE values...like:
>
> 1996
> 1997
> 1998
> 1999
> 2000
> 2001
> 2002
> 2003
> 2004
> 2005

You create a lookup dimension/table. You populate it with the serie you want. You then join from it to the applicable table using an outer join.

In Data Warehousing you will often find a date dimension/table that contains a row per day for years X to Z. Or a time dimension that contains a row per second for a 24h period.

--
Billy
Received on Tue Nov 18 2003 - 23:47:39 CST

Original text of this message

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