Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 30th, 2005, 12:58 PM
siaoling siaoling is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 siaoling User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 59 sec
Reputation Power: 0
Unhappy Problem in comparing time

Can anyone helps me to sove the problem.I would like to create a query to update a field name "Timely" to 'fast' in a delivery table when the delivery took less than or equals to 2 hours. But the main thing is that I can't compare the time in my sql command.Can anyone help me to solve out??

Query:
Update Delivery
set Timely = 'Fast'
where exists
(select to_char(to_date('00:00:00','HH24:MI:SS') +
(DelivEndTime - DelivStartTime), 'HH24:MI:SS') from delivery
where to_char(to_date('00:00:00','HH24:MI:SS') +
(DelivEndTime - DelivStartTime), 'HH24:MI:SS') <= (to_char(to_date('02:00:00','HH24:MI:SS') +
(DelivEndTime - DelivStartTime), 'HH24:MI:SS')));

I be able to update the data from the delivery table.but it's not working as more or less than 2 hours.It will just update all the records in that table.Therefore, I can't compare the time.Can anyone help me on that.Thanks a lot!!

Reply With Quote
  #2  
Old May 2nd, 2005, 08:22 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,824 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 1 Day 8 h 56 m 45 sec
Reputation Power: 278
This:
Code:
select
 round(to_number(to_date('02/05/2005 19:30', 'dd/mm/yyyy hh24:mi') - to_date('02/05/2005 18:30', 'dd/mm/yyyy hh24:mi'))*24)
 from dual 

returns the difference between two dates in hours.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Problem in comparing time


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway