Solved

Compare Oracle Date TIME with sql

Posted on 2008-06-20
3
4,418 Views
Last Modified: 2013-12-18
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
Comment
Question by:SarahDeng
3 Comments
 
LVL 47

Accepted Solution

by:
schwertner earned 500 total points
ID: 21836827
select * from mytable
where mydatetime > TO_DATE('06/20/2008 10:40:35pm','mm/dd/yyyy hh:mi:ss pm');
0
 

Author Closing Comment

by:SarahDeng
ID: 31469386
It is quick, easy and working solution! Thanks!!
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21837251
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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to recover a database from a user managed backup

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now