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 -> Re: SQL question....

Re: SQL question....

From: Alexander Penev <alex_at_cska.net>
Date: 2000/03/23
Message-ID: <38DA9945.E97C09F9@cska.net>#1/1

> SQL> select ename, job,hiredate
> 2 from emp
> 3 where hiredate between
> 4 to_date ('20-FEB-81') AND
> 5 to_date ('01-MAY-81')
> 6 ORDER BY hiredate
> 7 /
>

If you use 2 digit Year, Oracle adds the current century as default. So you search the dates between 2/20/2000 ad 5/01/2000

>
> no rows selected
>
> SQL> select ename, job,hiredate
> 2 from emp
> 3 where hiredate between
> 4 to_date ('20-FEB-1981', 'DD-MM-YYYY') AND
> 5 to_date ('01-MAY-1981', 'DD-MM-YYYY')
> 6 ORDER BY hiredate
> 7 /
>
> ENAME JOB HIREDATE
> ---------- --------- ---------
> ALLEN SALESMAN 20-FEB-81
> WARD SALESMAN 22-FEB-81
> JONES MANAGER 02-APR-81
> BLAKE MANAGER 01-MAY-81
>
> SQL> spool off
Received on Thu Mar 23 2000 - 00:00:00 CST

Original text of this message

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