The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question, Ece Nil.
Asked: February 11, 2017 - 5:03 pm UTC
Last updated: February 13, 2017 - 5:23 am UTC
Version: Oracle Database 11g Express Edition
Viewed 1000+ times
SELECT ename, hiredate FROM emp WHERE hiredate BETWEEN date '1981-01-01' and '1981-12-31'
SELECT ename, hiredate FROM emp WHERE hiredate BETWEEN to_date('01-JAN-1981','dd-mon-yyyy') AND to_date('31-DEC-1981','dd-mon-yyyy');
SQL> alter session set nls_date_format = 'DD/MM/YYYY'; Session altered. SQL> select to_date('01/02/1999') from dual; TO_DATE('0 ---------- 01/02/1999 1 row selected. SQL> alter session set nls_date_format = 'YYYY-MON-DD'; Session altered. SQL> select to_date('01/02/1999') from dual; select to_date('01/02/1999') from dual * ERROR at line 1: ORA-01843: not a valid month SQL> select to_date('1999-JAN-13') from dual; TO_DATE('19 ----------- 1999-JAN-13 1 row selected.
Share and learn SQL and PL/SQL; free access to the latest version of Oracle Database!
Classes, workouts and quizzes on Oracle Database technologies. Expertise through exercise!