Certain event needs to happen before the end of the year when it's 10 years since the previous event. I'm issuing a query like this to calculate the deadline:
SELECT
:previous_date AS previous_date,
ADD_MONTHS(
TO_DATE(
EXTRACT(
YEAR FROM TO_DATE(:previous_date, 'YYYY-MM-DD HH24-MI-SS')
) || '-12-31 23-59-59', 'YYYY-MM-DD HH24-MI-SS'
), 12*10
) AS deadline
FROM DUAL
E.g.:
PREVIOUS_DATE DEADLINE
------------- -------------------------
2008-07-15 31/12/2018 23:59:59
I works fine so far but... Am I missing some function that can make the query more readable?