Solved

oracle query

Posted on 2014-01-06
3
261 Views
Last Modified: 2014-01-06
I want to capture all expired frozen platelets products after 47 hours and 45 minutes from expiry_date

ie process_dats <= expiry_date + 47 hours and 45 mins.

Help appreciated.
script.txt
0
Comment
Question by:anumoses
3 Comments
 
LVL 34

Accepted Solution

by:
Mark Geerlings earned 125 total points
ID: 39759206
Try this:

select [whatever you need]
from [your_table]
where process_dats <= (expiry_date + 1 + 95/96)

or:
where process_dats <= (expiry_date + 191/96)

But, if you need to find expired records, and if they expire after two days (48 hours), then you may need to use ">=" (greater than or equla instaed of less than or equal) like this:

where process_dats >= (expiry_date + 1 + 95/96)

Date arithmetic explanation:  you  can add fractional portions of a day when you need Oracle to calculate or derive a date value.  For example, if you need to find all records that are almost one day (23 hours) old, you can do this:

where [date_column] >= sysdate + 23/24

In your case, where you need quarter-hour intervals, multiple the number of hours in a day by 4 (24 x4 = 96) to get the denominator to work with.
0
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 125 total points
ID: 39759401
you can also use interval math with explicit units

process_dats <= expiry_date + (interval '47' hour) + (interval '45' minute)
0
 
LVL 6

Author Closing Comment

by:anumoses
ID: 39759449
thanks a lot
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

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…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to recover a database from a user managed backup

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

20 Experts available now in Live!

Get 1:1 Help Now