Re: comparing dates
Anindya Mozumdar wrote:
> I have two variables named emp_hire_dt and emp_term_dt in a table. I want to remove all
> employees whose termination date is before hire date. Will the following work -
>
> delete from <tablename> where emp_term_dt < emp_hire_dt;
Yes, when the emp_hire_dt and emp_term_dt colums (or fields or attributes, but nor variables ;-)
are defined as DATE, DATETIME or TIMESTAMP.
When writing queries like the one you mention, it is always a good idea to "try" first with
SELECT * from <tablename> WHERE emp_term_ft < emp_hire_dt;
so you can see what you get.
--
felix
Subject
Written By
Posted
Re: comparing dates
April 25, 2005 10:45AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.