Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: CONSECUTIVE Values
"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.
-- BillyReceived on Tue Nov 18 2003 - 23:47:39 CST
![]() |
![]() |