====== pears.GetPhone ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."GetPhone"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "cpe" char(2),in "ptype" char(25),in "recid" char(20) )
returns char(250)
begin
declare "rv" char(250);
select "list"("phone"."number",'; ') into "rv" from "phone" key join "phonetype" where "phone"."whoid" = "recid"
and "phone"."who" = (if "cpe" = 'E' then 'CP' else "cpe" endif) and "phonetype"."name" = "ptype";
return("rv")
end