Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Help - newbie question on using date in SQL

Help - newbie question on using date in SQL

From: andi <andi_at_a.com>
Date: Fri, 15 Nov 2002 15:01:40 +0800
Message-ID: <ar24ah$6e8$1@reader01.singnet.com.sg>


Hi All,
I'm using oracle 8.1.7.0 on win2K.
I don't understand why the first sql statement doesn't return rows. The only difference between the two is the date of the second query is using 4 digits of year.

Please give me some light on this.

TIA.
-Andi-

SQL> select ename, hiredate from emp
  2 where hiredate between to_date('20-FEB-81','DD-MON-YY') AND to_date('20-MAY-81','DD-MON-YY');

no rows selected

SQL> ed
Wrote file afiedt.buf

  1 select ename, hiredate from emp
  2* where hiredate between to_date('20-FEB-1981','DD-MON-YYYY') AND to_date('20-MAY-1981','DD-MON-YYY')
SQL> / ENAME HIREDATE
---------- ---------

ALLEN      20-FEB-81
WARD       22-FEB-81
JONES      02-APR-81
BLAKE      01-MAY-81
Received on Fri Nov 15 2002 - 01:01:40 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US