[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Dates in "Where" Clause



> Does anybody know how to edit, format or manipulate dates when they are in a
> where clause?
>
> Platform is Oracle 7.3.3
> SQR3
>
> For example:
>
> Select Column_1 &Column_1
> Column_2  &Column_2
> >From PS_TABLE where Date = $Var_Date
>
>                 ! right now $Var_Date is manipulated into this format:  30-JUN-97
>
> Although the above statement works with the stated format I believe that I
> will have a problem after 01/31/1999 ?!?

Chris,

With all string variables containing dates, I strongly recommend
you do an explicit conversion.  Oracle provides the TO_DATE function
for this purpose (Sybase uses CONVERT).  For example:

where MyDate = to_date( $var_date , 'mm/dd/yyyy' )

Ray

----------------------------------------------------------------------
Ray Ontko       |  Ray Ontko & Co  |  "Time for a new signature line."
rayo@ontko.com  |  Richmond, In    |  See us at http://www.ontko.com/