====== pears.MergePhones ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create procedure "pears"."MergePhones"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "sphonewho" char(2),in "ssourceid" char(20),in "stargetid" char(20) ) begin update "phone" as "pq" set "whoid" = "stargetid" where "who" = "sphonewho" and "whoid" = "ssourceid" and not exists(select * from "phone" where "who" = "sphonewho" and "whoid" = "stargetid" and "phonetypeid" = "pq"."phonetypeid" and "number" = "pq"."number"); delete from "phone" where "whoid" = "ssourceid" and "who" = "sphonewho" end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."MergePhones" IS {create procedure MergePhones /* Application Maintained Function / Procedure - DO NOT EDIT*/ (in sphonewho char(2),in ssourceid char(20),in stargetid char(20)) begin update phone as pq set whoid=stargetid where who=sphonewho and whoid=ssourceid and not exists(select* from phone where who=sphonewho and whoid=stargetid and phonetypeid=pq.phonetypeid and number=pq.number); delete from phone where whoid=ssourceid and who=sphonewho end }