====== pears.psHealthUpdatePhone ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."psHealthUpdatePhone"( in "PID" char(20),in "typeid" char(20),in "num" char(100) )
begin
-- check email, prim or sec
if "typeid" = (select first "phonetypeid" from "phonetype" where "name" = 'E-Mail' and "applicant" = 1) then
update "psHealthPerson" set "transferbatch" = 0,"email" = "num" where "personid" = "Pid"
elseif "typeid" = (select first "phonetypeid" from "phonetype" where "name" = 'Mobile' and "applicant" = 1) then
update "psHealthPerson" set "transferbatch" = 0,"primarytelephone" = "num" where "personid" = "Pid"
elseif "typeid" = (select first "phonetypeid" from "phonetype" where "name" = 'Home Telephone' and "applicant" = 1) then
update "psHealthPerson" set "transferbatch" = 0,"secondarytelephone" = "num" where "personid" = "Pid"
end if
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."psHealthUpdatePhone" IS
{create procedure pears."psHealthUpdatePhone"( in PID char(20), in typeid char(20), in num char(100))
begin
-- check email, prim or sec
if "typeid" = (select first "phonetypeid" from "phonetype" where "name" = 'E-Mail' and "applicant" = 1) then
update "psHealthPerson" set "transferbatch" = 0,"email" = "num" where "personid" = "Pid"
elseif "typeid" = (select first "phonetypeid" from "phonetype" where "name" = 'Mobile' and "applicant" = 1) then
update "psHealthPerson" set "transferbatch" = 0,"primarytelephone" = "num" where "personid" = "Pid"
elseif "typeid" = (select first "phonetypeid" from "phonetype" where "name" = 'Home Telephone' and "applicant" = 1) then
update "psHealthPerson" set "transferbatch" = 0,"secondarytelephone" = "num" where "personid" = "Pid"
end if
end
}