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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Days between two days

Re: Days between two days

From: Imprecise <f_puhan_at_precise.com>
Date: Wed, 12 Jun 2002 18:38:17 -0400
Message-ID: <f_puhan-EA0856.18381712062002@vienna7.his.com>


In article <ae8gqj$4sdq7$1_at_ID-68406.news.dfncis.de>,  "James Alexander Starritt" <james_at_jamesstarritt.com> wrote:

> Any ideas how to work out the number of days between two dates in a select
> query?
>

set serveroutput on
set feedback off
set verify off

var daycount integer;

accept vday1 char prompt "Enter the EARLIEST date (format: MM/DD/YY): "; accept vday2 char prompt "Enter the LATEST date (format: MM/DD/YY): ";

BEGIN
  SELECT to_date('&&vday2','MM/DD/YY') - to_date('&&vday1','MM/DD/YY')     INTO :daycount
    FROM DUAL; DBMS_OUTPUT.PUT_LINE(' The number of days between &&vday1 and &&vday2 is '||:daycount);

END;
/

Try it.

-- 
The underscore character does not belong in my address. You know the drill...
***
Anyone sufficiently smart enough to configure and use USEnet for research should
be smart enough to Read The Freakin' Documentation!
Received on Wed Jun 12 2002 - 17:38:17 CDT

Original text of this message

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