I have a query in which I am calculating time. I want to make time double so that if the time is 01:40 then it should become 03:20. Here is my current query
SELECT TO_CHAR(TRUNC((ATN_INN-ACT_INN)*24),'09')||':'||
TO_CHAR(TRUNC(((ATN_INN-ACT_INN)*24-TRUNC((ATN_INN-ACT_INN)*24))*60),'09') B
FROM SML.EMP_INFO A
How should I go about this?
If you really what to work only with the time element, the easiest way to so is to employ the ‘SSSSS’ date mask, which returns the number of seconds after midnight. So this query will return double the number of seconds between the two columns:
Converting seconds into hours and minutes is left as an exercise for the reader.
Note that this query only makes sense if ATN_INN is later than ACT_INN but still on the same day. This is the clarification @Ben was trying to make (with no success). If this is not the case a different solution is required, something like ….
This returns the doubled different in minutes. Again, rendering the output into a display format is left to the reader.