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:
select ( to_number(to_char(atn_inn, 'sssss'))
- to_number(to_char(acn_inn, 'sssss')) ) * 2 as double_diff_in secs
from sml.emp_info
/
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 ….
select ( ( extract ( hour from diff ) * 60)
+ extract ( minute from diff ) ) *2 as double_diff_in mins
from ( select to_dsinterval ( atn_inn - act_inn ) as diff
from sml.emp_info )
/
This returns the doubled different in minutes. Again, rendering the output into a display format is left to the reader.
1
solved Double the current time [closed]