One of your applications requires that you have the ability to add any number of days, hours, minutes, or seconds to a given date and time to produce a new date and time.
Create functions that add each of these time values to
TIMESTAMP dataypes that are passed as an argument. Each of these functions will return the given time plus the amount of time that is passed in as argument. The following three functions will provide the ability to add hours, minutes, seconds, or days to a given time. Each of these functions returns the calculated date and time using the
CREATE OR REPLACE FUNCTION calc_hours(time_to_change IN TIMESTAMP, timeval ...