Code:
------------------------------ Commands Entered ------------------------------
values date('2008-08-31')-date('2008-01-01');
------------------------------------------------------------------------------
1
----------
730.
yyyymmdd
1 record(s) selected.
Please note 2nd to 4th rows of the following results.
Code:
------------------------------ Commands Entered ------------------------------
SELECT to_date, from_date
, DAYS(to_date) - DAYS(from_date) AS "days"
, to_date - from_date AS " yyyymmdd"
FROM (VALUES ( DATE('2008-08-31'), DATE('2008-01-01') )
, ( DATE('2009-03-01'), DATE('2009-02-01') )
, ( DATE('2008-03-01'), DATE('2008-02-01') )
, ( DATE('2008-04-01'), DATE('2008-03-01') )
) data(to_date, from_date);
------------------------------------------------------------------------------
TO_DATE FROM_DATE days yyyymmdd
---------- ---------- ----------- ----------
2008-08-31 2008-01-01 243 730.
2009-03-01 2009-02-01 28 100.
2008-03-01 2008-02-01 29 100.
2008-04-01 2008-03-01 31 100.