Compare Oracle Date TIME with sql

Experts,

  This is an urgent request. I need compare the colume of datetime type (e.g. 06/21/2008 11:30:00pm) with a timestampe like (e.g 06/21/2008 10:40:35). what is quick way to do that?

select * from mytable
where mydatetime > '06/20/2008 10:40:35pm'
SarahDengAsked:
Who is Participating?
 
schwertnerConnect With a Mentor Commented:
select * from mytable
where mydatetime > TO_DATE('06/20/2008 10:40:35pm','mm/dd/yyyy hh:mi:ss pm');
0
 
SarahDengAuthor Commented:
It is quick, easy and working solution! Thanks!!
0
 
DauheeCommented:
you can compare them directly in sql if not hardcoding values so:

SELECT  sysdate - SYSTIMESTAMP FROM dual
select * from table where date_col > timestamp_col

http://www.psoug.org/reference/timestamp.html
0
All Courses

From novice to tech pro — start learning today.