We have an absence type called Vaccine, and the client wants that this absence-type employee can add the day of vaccination not before that. For that, we have written a fast formula in order to achieve this requirement.
DEFAULT FOR IV_START_DATE is '0001/01/01 00:00:00' (Date)
INPUTS ARE IV_START_DATE (Date)
L_SYSDATE = '4712/12/31 00:00:00' (date)
l_start_date = to_date(to_char(IV_START_DATE, 'YYYY/MM/DD' ), 'YYYY/MM/DD')
L_SYSDATE = GET_CURRENT_DATE()
IF (l_start_date > L_SYSDATE)
error_message = 'Start date cannot be in the future. sysdate = ' || to_char(l_sysdate, 'yyyy/mm/dd HH24:MI:SS') || ' start date = ' || to_char(iv_start_date, 'yyyy/mm/dd HH24:MI:SS')
RETURN VALID, ERROR_MESSAGE
I hope this blog post was helpful for you. If you have any questions or feedback, please leave a comment below.