I have requirement, this is for a report.
Requirement description:
Need data from a table which are in OPEN status for more than 30 minutes
Well, the above requirement can be obtained from
select *
from xyz
where status = 'OPEN'
and last_update_date <= sysdate - (30/1440) --30 is minutes and its a parameter
the above query will fetch all the data which are in OPEN status from beginning to sysdate - (30/1440). so i want to modify the query to restrict the complete data , by adding another parameter like DAY
for example if i give 10 as day, it should fetch all the data only in the last 10 days and sysdate-30 minutes. we should use last_update_date column for restricting the day.
If I dont give any day as input if should fetch all the records from sysdate-30 minutes. If I dont give minutes it should fetch all the records in OPEN status.
is the question clear enough? My English is bad.
Please suggest me a query..