[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Date Comparison in Oracle
- Subject: Re: Date Comparison in Oracle
- From: "Kulshrestha, Alok" <ALOKKULSHRESTHA@IMF.ORG>
- Date: Thu, 24 Sep 1998 11:24:05 -0400
If You are using Peoplesoft :
Call "dtu-diff-days($dtu_date1, $dtu_date2, :#dtu_days)" procedure from
"Datemath.sqc".
where $dtu_date1, $dtu_date2 are dates in 'YYYY-MM-DD' format, to get the
difference in days.
If you are not using Peoplesoft :
The codes looks like as below ......
-----------------------
BEGIN-SELECT
to_date($date1,'YYYY-MM-DD') - to_date($date2,'YYYY-MM-DD') &diff_days
from Dual
END-SELECT
----------------------
in any case, Once you have #dtu_days ( difference in days), can compare the
dates.
Hope it helps...
-alok
On Thursday, September 24, 1998 10:58 AM, Hope, Sandra
[SMTP:HopeS@DYNCORP.COM] wrote:
: I need to select the earlier of several dates within an SQR.
: I've tried various date formats and using
:
: if $Date1 < Date2
: let $Date3 = Date2
: end-if
:
: I don't get date errors but the program simply replaces each date whether
it
: is earlier or not. Is there a special format required for this syntax or
is
: there a different way to compare dates? Thanks All.
:
: SHope