core-jgi/db/ddlutils/postgresql/functions/Add_Months.sql

14 lines
334 B
MySQL
Raw Normal View History

CREATE OR REPLACE FUNCTION add_months (in datetime timestamptz, in months numeric) RETURNS date AS
$BODY$
declare duration varchar;
BEGIN
if datetime is null or months is null then
return null;
end if;
duration = months || ' month';
return cast(datetime + cast(duration as interval) as date);
END;
$BODY$
LANGUAGE 'plpgsql'
;