Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.AddPhone ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create procedure "pears"."AddPhone"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "cpe" char(2),in "ptype" char(25),in "recid" char(20),in "snumber" char(200) ) begin declare "tpid" char(20); declare "sid" char(20); if "trim"("isnull"("ptype",'')) = '' then return end if; if "trim"("isnull"("recid",'')) = '' then return end if; if "trim"("isnull"("snumber",'')) = '' then return end if; if "cpe" = 'E' then set "cpe" = 'CP' end if; set "tpid" = null; if "cpe" = 'C' then select "phonetypeid" into "tpid" from "phonetype" where "name" = "ptype" and "company" = 1 else if "cpe" = 'P' then select "phonetypeid" into "tpid" from "phonetype" where "name" = "ptype" and "applicant" = 1 else if "cpe" = 'CP' then select "phonetypeid" into "tpid" from "phonetype" where "name" = "ptype" and "contact" = 1 end if end if end if; if "tpid" is null then return end if; set "sid" = "uniquekey"('x'); insert into "phone"( "phoneid","phonetypeid","who","whoid","number" ) values( "sid","tpid","cpe","recid","snumber" ) end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."AddPhone" IS {create procedure AddPhone /* Application Maintained Function / Procedure - DO NOT EDIT*/ (in cpe char(2),in ptype char(25),in recid char(20),in snumber char(200)) begin declare tpid char(20); declare sid char(20); if trim(isnull(ptype,'')) = '' then return end if; if trim(isnull(recid,'')) = '' then return end if; if trim(isnull(snumber,'')) = '' then return end if; if cpe = 'E' then set cpe='CP' end if; set tpid=null; if cpe = 'C' then select phonetypeid into tpid from phonetype where name = ptype and company = 1 else if cpe = 'P' then select phonetypeid into tpid from phonetype where name = ptype and applicant = 1 else if cpe = 'CP' then select phonetypeid into tpid from phonetype where name = ptype and contact = 1 end if end if end if; if tpid is null then return end if; set sid=uniquekey('x'); insert into phone(phoneid,phonetypeid,who,whoid,number) values(sid,tpid,cpe,recid,snumber) end } </code> database/procedures/pears_addphone.txt Last modified: 2026/08/07 19:24by 127.0.0.1