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.AWRLinkedPlacements ====== <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"."AWRLinkedPlacements"( in "JobMid" char(20),in "placeid" char(20) ) result( "Jobmasterid" char(20),"Linkedflag" char(1) ) begin -- return a list of already linked AWR records in the correct order and potential linked ones declare @lecode char(50); declare @linkcode char(50); declare @personid char(20); declare @companyid char(20); select "LECode","AWRLinkCode","employment"."personid","company"."companyid" into @lecode,@linkcode,@personid,@companyid from "AWRCompany" key join "company" key join "employment" key join "placement" key join "AWRjobmaster" where "AWRJobmasterid" = "jobmid"; if @LECode is null then select "AWRJobmasterid",(if "AWRLinkCode" is not null and "AWRLinkCode" = @linkcode then 'Y' else 'N' endif) from "AWRJobmaster" key join "placement" key join "employment" key join "company" key join "AWRcompany" where "company"."companyid" = @companyid and "AWRJobMasterID" <> "JobMid" and "employment"."personid" = @personid else select "AWRJobmasterid",(if "AWRLinkCode" is not null and "AWRLinkCode" = @linkcode then 'Y' else 'N' endif) from "AWRJobmaster" key join "placement" key join "employment" key join "company" key join "AWRcompany" where "LECode" = @LECode and "AWRJobMasterID" <> "JobMid" and "employment"."personid" = @personid end if end </code> database/procedures/pears_awrlinkedplacements.txt Last modified: 2026/08/07 19:24by 127.0.0.1