what is the maximum difference between END_TS and START_TS
... if its more than 24 hours you can't store it in an column of type TIME.
Indeed subtracting two timestamps results in an DEC(20,6) number
consisting of:
yyyymmddhhmmss,zzzzz
where yyyy is the difference of years,
mm is the difference of month, dd of days and so on till zzzzz the difference of microseconds.
if you calculate:
ts1 = ' 2006-07-20-15.31.08.135090' and
ts2 = ' 2006-07-21-15.34.18.135090'
ts2 - ts1 will result in the decimal number
00000001000310,000000
( difference is 0 years, 0 month, 1 day, 0 hours, 3 minutes and 10 seconds )
so, if the maximum difference of the timestamps is less than 24 hours, the maximum value you may receive is
00000000235959,999999
( 23 hours, 59 minutes, 59 seconds and 999999 microseconds )
this number can be cast to a decimal(6,0) which can be interpreted as an time duration and -by added to time 00:00- be trasformed to a TIME-type
if the maximum difference is more than 24 hours, you can't it store in an TIME column