Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: sql question
('binary' encoding is not supported, stored as-is)
or this ;-)
select 1995+n from
(select level-1 n from dual connect by level <=
(select to_number(to_char(sysdate,'YYYY'))-1995+1 from dual ) ) /
Stauffer, Robert G wrote:
> Or maybe something like:
>
> SQL> select rownum+&begin-1 from big_table where rownum <
> ((&end+1)-(&begin-1));
> Enter value for begin: 1995
> Enter value for end: 2006
> Enter value for begin: 1995
> old 1: select rownum+&begin-1 from watchdog.maintenance_log where
> rownum < ((&end+1)-(&begin-1))
> new 1: select rownum+1995-1 from watchdog.maintenance_log where
> rownum < ((2006+1)-(1995-1))
>
> ROWNUM+1995-1
> -------------
> 1995
> 1996
> 1997
> 1998
> 1999
> 2000
> 2001
> 2002
> 2003
> 2004
> 2005
> 2006
>
> 12 rows selected.
>
> SQL>
>
>
>
>> *From:* oracle-l-bounce_at_freelists.org
> ------------------------------------------------------------------------
>
>
>
> SQL> select * from table(betwixt('15-APR-2006','20-APR-2006'));
>
> DT
> -----------
> 16-APR-2006
> 17-APR-2006
> 18-APR-2006
> 19-APR-2006
> 20-APR-2006
>
> 5 rows selected.
>
> SQL> select to_char(dt,'YYYY') from
> table(betwixt('01-JAN-1995','01-JAN-2006',366));
>
> TO_C
> ----
> 1996
> 1997
> 1998
> 1999
> 2000
> 2001
> 2002
> 2003
> 2004
> 2005
> 2006
>
> 11 rows selected.
>
>
> >
>> Can anyone think of a way to generate a list of years from say 1995 to >> the current year in straight sql? >> >> >> chris >> -- >> http://www.freelists.org/webpage/oracle-l >> >> >> >>
> > > >
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. If the reader of this message is not the intended recipient, you are hereby notified that your access is unauthorized, and any review, dissemination, distribution or copying of this message including any attachments is strictly prohibited. If you are not the intended recipient, please contact the sender and delete the material from any computer.
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Apr 20 2006 - 16:20:49 CDT