Re: sql question

  • From: Tim Gorman <tim@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 20 Apr 2006 14:54:01 -0600

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
--
//www.freelists.org/webpage/oracle-l



  
-- //www.freelists.org/webpage/oracle-l

Other related posts: