Re: Table with one row

From: <zeldorblat_at_gmail.com>
Date: 22 Oct 2005 19:29:11 -0700
Message-ID: <1130034551.098552.37640_at_g43g2000cwa.googlegroups.com>


>[db2inst1_at_wb-01 ~]$ db2 "create view today (yesterday, today,tomorrow)
>as (values (current date - 1 day, current date, current date + 1 day))"
>DB20000I The SQL command completed successfully.

The whole point of having a table for it is that it /doesn't/ have to be the same as the current date (in the "real world"). In our case, our daily processing run occurs at 11:00 AM. At that point we advance the dates in the table. So, on any given day, after the job has run, the value of "today" is one day ahead of the current date -- since we are already on the next processing date.

With the help of a calendar table, it's also easy to skip weekends and holidays. For example, right now (10/22/2005 at 10:30 PM EST) the table has the following in it:

today = 10/24/2005
yesterday = 10/21/2005
tomorrow = 10/25/2005 Received on Sun Oct 23 2005 - 04:29:11 CEST

Original text of this message