In operation there are three shift A - 6AM to 2PM , B- 2PM to 10PM and C - 10PM to 6AM.
I have a query that fetches production between certain date. I want to create a procedure that will run at end of each shift and give production output of the last shift only for that day.
Can you please help how to write this query.
My current query is something like this
select sum(mass) from tab1
from tab1
where
time1 between '01-JAN-2013' and '02-JAN-2013'
I need to incorporate this in a stored procedure and schedule this procedure at the end of each shift and this should give output of the last shift only.
Kindly help me in getting the query.