What can you do if there are more than 9999 days between the timestamps? I am trying to get the number of seconds elapsed (ideally as decimal rather than interval). For instance, this gives an error:
SELECT
CURRENT_TIMESTAMP AS t2,
(t2 - INTERVAL '9999' DAY - INTERVAL '30' DAY) t1,
(t2 - t1) DAY(4) TO SECOND delta
I can write a case statement that returns results only when the difference is between +/-9999 days, but when the difference is outside this range, it can only return null
. I would like to get the number of seconds for these cases.
What can you do if there are more than 9999 days between the timestamps? I am trying to get the number of seconds elapsed (ideally as decimal rather than interval). For instance, this gives an error:
SELECT
CURRENT_TIMESTAMP AS t2,
(t2 - INTERVAL '9999' DAY - INTERVAL '30' DAY) t1,
(t2 - t1) DAY(4) TO SECOND delta
I can write a case statement that returns results only when the difference is between +/-9999 days, but when the difference is outside this range, it can only return
null
. I would like to get the number of seconds for these cases.