====== pears.tempslotstartdate ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."tempslotstartdate"( in "tsid" char(20) ) returns date begin declare "rv" date; select "employment"."startdate" into "rv" from "tempslot" key join "placement" key join "employment" where "tempslot"."tempslotid" = "tsid"; if "rv" is null then select "weekenddate"("tempslot"."yearnumber","tempslot"."weeknumber") into "rv" from "tempslot" where "tempslotid" = "tsid" end if; if "rv" is null then set "rv" = current date end if; return("rv") end