pears.GetHolidayYear
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
Original SQL
CREATE FUNCTION "pears"."GetHolidayYear"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ IN "startdate" DATE,IN "calcdate" DATE ) RETURNS DATE BEGIN /*More than a year ago?*/ "SetCurrentYear": loop IF "days"("startdate","calcdate") >= 365 THEN SET "startdate" = "years"("startdate",1) ELSE leave "SetCurrentYear" END IF END loop "SetCurrentYear"; /*Check after regulations startdate*/ IF "startdate" < "date"('1998-10-01') THEN SET "startdate" = "date"('1998-10-01') END IF; RETURN("startdate") END