====== pears.EntityGrade ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."EntityGrade"( in "VacID" char(20),in "PersID" char(20),in "PlacID" char(20),in "ShiftID" char(20) )
returns char(4)
begin
declare "rv" char(4);
-- Return Null to match all grades. Null grades are always matched, whatever is returned
-- If Grades set up for minimum wage for Age range the AWR grade needs to be amended to return NULL in AWR Entity Grade function
set "rv" = null;
if "shiftid" is not null then
select first "essentialskillgradeid" into "rv" from "tempshift" where "tempshiftid" = "shiftid"
end if;
return "rv"
end