Solved

Compare Oracle Date TIME with sql

Posted on 2008-06-20
3
4,417 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.

Join & Write a Comment

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
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, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

757 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

17 Experts available now in Live!

Get 1:1 Help Now