Rollover Minutes Calculation
Posted on 2012-08-30
I need assistance with a problem that consists of calculating the total hours, total minutes, and any minutes that exceed 60 minutes, should be carried over and added to the hours column and displaying for the total minutes the remaining. Currently, I have written code to account of the summation of hours and minutes, however; the rollover minutes to append or add to the hours column, has imposed a bit of a challenge. I have provided my code as a snapshot of what I am trying to accomplish.
TRIM(LEADING '-' FROM SUM((EXTRACT(HOUR FROM CHECK_OUT) - EXTRACT(HOUR FROM CHECK_IN)) )) AS TOTAL_HRS,MOD(SUM(EXTRACT(MINUTE FROM (CHECK_OUT - CHECK_IN)) ),60) AS TOTAL_MINUTES
We are currently running Oracle 10g and using PL SQL has the programming lang. I hope this explains everything that I am trying to accomplish.
Thank You in Advance