Re: SQL Problem

"Mark Anderson" <[email protected]> Wed, 19 Feb 2003 10:37:11 -0000
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-880234-2003.02.19-10.36.40--gcdod-oracle#[email protected]>
Tony,
As a question and not really involved in this topic, would you not use
to_date on a date if you only wanted the month portion or even the
month/year portion? i.e. to_date(v.vtran_effective_date, 'Mon-YYYY').

Mark

-----Original Message-----
From: Tony Andrews [mailto:[email protected]]
Sent: 19 February 2003 10:45
To: Oracle
Subject: [oracle] Re: SQL Problem


>I think if you use to_date() in all the date during the comparation. It
also works.
>(to_date(v.vtran_effective_date) between to_date(z.voidstart) and to_date
(z.voidend))

Wrong!  If the columns are of datatype DATE then you should not use
TO_DATE on any of them - what is the point of converting a DATE to a DATE?
In fact, since the TO_DATE function expects a VARCHAR2 input, what Oracle
will do with this is:



---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].