Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4444
  • Last Modified:

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'
0
SarahDeng
Asked:
SarahDeng
1 Solution
 
schwertnerCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now