Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Problem with query with dates in where clause
Hi,
If the hiredate is inserted as sysdate it inserts upto 1/100th (I believe) of a
second the exact time. Than if you querry using sysdate it will use the exact
sysdate of querry time which is again 1/100th of a second accurate and will
therefore not return anything.
Hiredate could be inserted as trunc(sysdate) which is at the start at midnight
of that day and querry using trunc(sysdate).
the second option is not valid you have to use to_date(19-JUN-00,'dd-mon-rr')
Jack
"B Siva Shankar" <bsshankar_at_chennai.tcs.co.in>@fatcity.com on 06/19/2000 09:24:34 AM
Please respond to ORACLE-L_at_fatcity.com
Sent by: root_at_fatcity.com
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
cc:
Subject: Problem with query with dates in where clause
Hi List,
We have problems in queries which have dates in where clause.
Select * from Emp
where hiredate = sysdate;
Select * from Emp
where hiredate = '19-JUN-00';
The above two queries are not returning any records even though there are some records in the table satisfying the criteria.
Can someone explain why it is so. We don't want to use to_char while comparing.
Thanks in advance,
Shiva.
-- Author: B Siva Shankar INET: bsshankar_at_chennai.tcs.co.in Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Mon Jun 19 2000 - 05:05:43 CDT
===================================================================
De informatie verzonden met dit E-mail bericht is uitsluitend bestemd voor de geadresseerde. Gebruik van deze informatie door anderen dan de geadresseerde is verboden. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is niet toegestaan. Ernst & Young staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden E-mail, noch voor tijdige ontvangst daarvan.
===================================================================
The information contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. Ernst & Young is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its