Solved

oracle query with substracting 60 minutes from time

Posted on 2014-01-29
2
383 Views
Last Modified: 2014-01-29
select current_date,
       to_char(current_date,'HH24:MI') currenttime,
       schedule_start_time,
         to_char(schedule_start_time,'HH24:MI') starttime,
       schedule_end_time,
         to_char(schedule_end_time,'HH24:MI') endtime,
           case when to_char(current_date,'HH24:MI')
             between to_char(schedule_start_time,'HH24:MI') and to_char(schedule_end_time,'HH24:MI')
             then 'in between'
             else 'not in between'
           end between_times
  from drives@qdon d,sites s
 where d.location_id = s.lt_location_id
   and drive_id = 'DRV5543050'
   and drive_date = trunc(sysdate);


CURRENT_DATE,CURRENTTIME,SCHEDULE_START_TIME,STARTTIME,SCHEDULE_END_TIME,ENDTIME,BETWEEN_TIMES

1/29/2014 11:31:10 AM,11:31,1/29/2014 11:30:00 AM,11:30,1/29/2014 7:00:00 PM,19:00,in between

I want to substract 60 minutes from both

 schedule_start_time and to_char(schedule_start_time,'HH24:MI') starttime

Help is appreciated
0
Comment
Question by:anumoses
2 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39818395
many ways to subtract 1 hour.

Try:
date_column-(60/1440)
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39818421
thanks that worked
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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

708 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

11 Experts available now in Live!

Get 1:1 Help Now