|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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!! |
|
#2
|
||||
|
||||
|
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.
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Problem in comparing time |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|