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 in message
news:bpdvhc$2fu$1_at_reader2.panix.com...
> SQL> select MIN(c_year), MAX(c_year)
> 2 from T
> 3 ;
>
> MIN(C_YEAR) MAX(C_YEAR)
> --------------------------- ---------------------------------------------
--Received on Tue Nov 18 2003 - 16:01:15 CST
> -
> 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
>
> Thanks
>
>
1 select 1995 + rn 2 from (select rownum rn from dba_objects) 3* where rn between 1 and 10 sql>/ 1995+RN ---------- 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005