[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
- Subject: Re: Dates in "Where" Clause
- From: Ray Ontko <rayo@ONTKO.COM>
- Date: Thu, 2 Oct 1997 07:04:36 -0500
- In-Reply-To: <B9D4B63001063B0C@-SMF-> from Christian Hagen at "Oct 1, 97 07:12:00 pm"
> 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/