Solved

oracle query

Posted on 2014-01-06
3
274 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 35

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 74

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
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, 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.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

762 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