Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Dates
To be clear, try:
ALTER SESSION SET NLS_DATE_FORMAT=3D'YYYY-MM-DD HH24:MI:SS';
However, I believe 'LIKE' on a date field implies any time from 00:00:00 =
to 23:59:59 will match.
That ought to explain the difference between #1 and #2.
As for the difference between #3 and #4, '25-JUN-04' implies June 25th, =
2004, 00:00:00.
So, in 3, there are no records between 00:00:00 and 00:00:00 on June =
25th.
In #4, you'looking from June 24th, 2004 00:00:00 through June 26th, 2004 =
00:00:00, which clearly encompasses all datetimes on June 25th, so you =
get those two records.
Nothing unusual here.
Hope that helps,
-Mark
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Oracle
Sent: Friday, June 25, 2004 11:36 AM
To: oracle-l_at_freelists.org
Subject: Dates
Hi
Can any please explain the reason for the differing results in the =
folowing
queries
1)
SELECT NCSN, NC_DATE_CLS FROM NONCONFORM WHERE NC_DATE_CLS LIKE =
'25-JUN-04'
NCSN NC_DATE_CLS
--------- --------- 3298 25-JUN-04 3299 25-JUN-04
2)
SELECT NCSN, NC_DATE_CLS FROM NONCONFORM WHERE NC_DATE_CLS =3D =
'25-JUN-04'
no rows selected
3)
SELECT NCSN, NC_DATE_CLS FROM NONCONFORM WHERE NC_DATE_CLS between
'25-JUN-04' AND '25-JUN-04';
no rows selected
4)
SELECT NCSN, NC_DATE_CLS FROM NONCONFORM WHERE NC_DATE_CLS between
'24-JUN-04' AND '26-JUN-04'
NCSN NC_DATE_CLS
--------- --------- 3298 25-JUN-04 3299 25-JUN-04
Table nonconform....columns....NCSN NUMBER, NC_DATE_CLS DATE...... Oracle 8.1.7
Thanks
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html ----------------------------------------------------------------- ---------------------------------------------------------------- Please see the official ORACLE-L FAQ: http://www.orafaq.com ---------------------------------------------------------------- To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Fri Jun 25 2004 - 10:41:30 CDT
![]() |
![]() |