You need to convert the literal to DATE using TO_DATE and the required format mask to compare the timestamp column with the timestamp values.
Customization
SQL> CREATE TABLE t(A TIMESTAMP); Table created. SQL> SQL> INSERT INTO t(A) VALUES(to_date('2015-04-10T15:39:00', 'YYYY-MM-DD"T"HH24:MI:SS')); 1 row created. SQL> INSERT INTO t(A) VALUES(to_date('2015-05-01T15:39:00', 'YYYY-MM-DD"T"HH24:MI:SS')); 1 row created. SQL> INSERT INTO t(A) VALUES(to_date('2015-03-01T15:39:00', 'YYYY-MM-DD"T"HH24:MI:SS')); 1 row created. SQL> COMMIT; Commit complete. SQL> SELECT * FROM t; A ---------------------------- 10-APR-15 03.39.00.000000 PM 01-MAY-15 03.39.00.000000 PM 01-MAR-15 03.39.00.000000 PM
Query
SQL> SELECT * 2 FROM t 3 WHERE A BETWEEN 4 to_date('2015-04-06T15:39:00', 'YYYY-MM-DD"T"HH24:MI:SS') 5 AND 6 to_date('2015-05-06T15:39:00', 'YYYY-MM-DD"T"HH24:MI:SS'); A -------------------------------------------------------------------------- 10-APR-15 03.39.00.000000 PM 01-MAY-15 03.39.00.000000 PM
So, I got the required rows as the desired result.
source share