Determining missing dates from a table (A date logic prob)

From: Rajeev Gupta <guptar_at_MCS.COM>
Date: 14 Jun 1994 10:57:51 -0500
Message-ID: <2tkk1v$mv_at_Venus.mcs.com>


Hi DB Gurus,

I have a small but intersting problem and wondering how other persons will tackle it.

Ok the problem is as follows :

I have a table in Oracle7 (DAILY_SALES) which contains a row for everyday with a date column (say sales_date).

As an exception, some rows are missing for certain days [let's assume aproax. 10 rows are missing from a reference date (say Nov. 1st 93) to till date.]

It is required to find out those dates which are missing from table.

One obvious solution is to build a table (ALL_DATES) of all dates since the reference point ( Nov 1st 93) untill sysdate. and excute the query to find out all dates in (ALL_DATES) which do not exist in DAILY_SALES. But this requires daily maintenance of reference table.

I am interested in some solution which uses certain functions/mechanism to provide the members of set which do not exist in table.

I hope this is one of the frequent request in date logic processing.

Thanks in Advance.

/Rajeev

:_:__:____:______:________:__________:_____________:______________:_______

   RAJEEV GUPTA
   United States Cellular Corporation (MRRGroup),    Chicago, IL 60631-3215
   Email Internet-->guptar_at_Mercury.mcs.com, FAX (313)399-4999 Take things easy .. and relax for a while .. :_:__:____:______:________:__________:_____________:______________:_____     Received on Tue Jun 14 1994 - 17:57:51 CEST

Original text of this message