Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: sql question

Re: sql question

From: Tim Gorman <tim_at_evdbt.com>
Date: Thu, 20 Apr 2006 14:54:01 -0600
Message-ID: <4447F4E9.3070206@evdbt.com>




  


Chris,

Hee hee!  I get to trot out the good ol' BETWIXT pipelined table function, which you can use in 8i upwards.  Source code is downloadable from "http://www.EvDBT.com/betwixt.sql"...

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.
Hope this helps!

-Tim


Chris Stephens wrote:
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



  
-- http://www.freelists.org/webpage/oracle-l Received on Thu Apr 20 2006 - 15:54:01 CDT

Original text of this message

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