I have observed a weired problem with between operator and sysdate.
please observe the following queries
/*I have inserted a row as below with the date as '9-MAY-02'
*/
SQL> insert into test values (8885,'9-MAY-02');
1 row created.
/* Then i have run the following query. which gives the results from 20-apr-02 to 10-may-02 (including 10-may-02). This is fine. But observe the follwing two queries also.
*/
SQL> select empno,hiredate from test where hiredate between '20-apr-02' and '10-MAY-02';
/* Here I have inserted a row with date as sysdate.
*/
SQL> insert into test values (8886,sysdate);
1 row created.
/* Now I have run the following query, but it has return the rows from 20-apr-02 to 9-may-02 only. The actual behaviour is, it has to return the rows even with 10-may-02.
*/
SQL> select empno,hiredate from test where hiredate between '20-apr-02' and '10-MAY-02';
Bookmarks