====== pears.TempaidTempEmaill ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."TempaidTempEmaill"( in "pid" char(20) ) returns varchar(100) begin declare "rv" varchar(100); select "isnull"("person"."payrollemailaddress",(select first "phone"."number" from "phone" key join "phonetype" where "phone"."who" = 'P' and "phone"."whoid" = "pid" and "phonetype"."name" like '%E%mail%'),'') into "rv" from "person" where "personid" = "pid"; return("rv") end