[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



First of all, if you are selection the earlier dates shouldn't the let
statement be  'let $Date3 = $Date1' instead?

Anyway, convert both date into YYYYMMDD format before you perform the
comparison.

move $Date1 to $c_Date1 YYYY|MM|DD
move Date2 to $c_Date2 YYYY|MM|DD

if $c_Date1 < $c_Date2
     let $Date3 = Date1
end-if

>-----Original Message-----
>From:  Hope, Sandra [SMTP:HopeS@DYNCORP.COM]
>Sent:  Thursday, September 24, 1998 10:58 AM
>To:    Multiple recipients of list SQR-USERS
>Subject:       Date Comparison in Oracle
>
>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