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

Home -> Community -> Usenet -> c.d.o.server -> Re: Help with sql-query

Re: Help with sql-query

From: Matt T <puskas.duck_at_gmail.com>
Date: Thu, 21 Jun 2007 09:53:43 -0000
Message-ID: <1182419623.911282.283880@q75g2000hsh.googlegroups.com>

  1. Create a Calendar table

Create table calendar( cal_name varchar2(255) not null,

                                 cal_date date );

2) Populate that calendar with all the days for the year.

   Insert into calendar
select 'TESTCAL', trunc(sysdate,'Year') + rownum -1 from all_objects where rownum<=365;

3) Use the calendar table as the driver for your queries

select * from calendar,

                   <yourtable>

where cal_name = 'TESTCAL'
and cal_cad_date between <yourstartdate> and <yourenddate> Received on Thu Jun 21 2007 - 04:53:43 CDT

Original text of this message

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