====== pears.NetVacancyRoleAllowed ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetVacancyRoleAllowed" IS {create FUNCTION pears.NetVacancyRoleAllowed(in pWebUserID char(20), in pVacancyID char(20), in pVacancyRoleExternalCode char(20)) returns smallint begin if not exists (select * from VacancyRoleAllocation a key join VacancyRole r where a.VacancyID=pVacancyID and r.ExternalCode=pVacancyRoleExternalCode) then return 1 -- Nobody assigned to this role - anyone can do end if; if exists (select * from VacancyRoleAllocation a key join VacancyRole r, VacancyRoleAllocation a key join employment key join iqxnetuserlink x where a.VacancyID=pVacancyID and r.ExternalCode=pVacancyRoleExternalCode and x.IQXNetUserID=pWebUserID) then return 1 end if; return 0; end }