====== pears.NetIncomingApplications ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create procedure "pears"."NetIncomingApplications"( in "pWebUserId" char(20),in "Jobid" char(20) default null ) result( "pResult" char(250) ) begin declare "Person" char(20); declare "Applied" char(20); declare "VacancyOwner" char(20); if "pWebUserId" is null then select '99:~You are not logged in'; return end if; set "VacancyOwner" = (select "staffid" from "vacancy" where "vacancyid" = "JobId"); set "Person" = (select "IQXNetUserLink"."PersonID" from "IQXNetUserLink" where "iqxnetuserlink"."iqxnetuserid" = "pwebuserid"); set "Applied" = (select "status" from "progress" where "vacancyid" = "JobId" and "personid" = "person"); if "Applied" > '' then select '99:~You have already Applied for this post'; return end if; insert into "progress"( "progressid","vacancyid","actiondate","status","personid","staffId" ) values( "uniquekey"('X'),"JobId","getdate"(),'A',"Person","VacancyOwner" ) ; select '0:~Success' end /* Unsafe - do not use without re-write */ go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetIncomingApplications" IS {create PROCEDURE pears."NetIncomingApplications"( in "pWebUserId" char(20),in "Jobid" char(20) default null ) result( "pResult" char(250) ) begin declare "Person" char(20); declare "Applied" char(20); declare "VacancyOwner" char(20); if "pWebUserId" is null then select '99:~You are not logged in'; return end if; set "VacancyOwner" = (select "staffid" from "vacancy" where "vacancyid" = "JobId"); set "Person" = (select "IQXNetUserLink"."PersonID" from "IQXNetUserLink" where "iqxnetuserlink"."iqxnetuserid" = "pwebuserid"); set "Applied" = (select "status" from "progress" where "vacancyid" = "JobId" and "personid" = "person"); if "Applied" > '' then select '99:~You have already Applied for this post'; return end if; insert into "progress"( "progressid","vacancyid","actiondate","status","personid","staffId" ) values( "uniquekey"('X'),"JobId","getdate"(),'A',"Person","VacancyOwner" ) ; select '0:~Success' end /* Unsafe - do not use without re-write */ }