====== pears.GetPlacementID ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."GetPlacementID"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "persid" char(20),in "vacid" char(20) )
returns char(20)
begin
for "forlab" as "curs" dynamic scroll cursor for
select "placement"."placementid" from "placement" key join "employment"
where "placement"."vacancyid" = "vacid" and "employment"."personid" = "persid"
and "placement"."temp" <> 0 order by "isnull"("employment"."leavedate",current date+3650) desc do
return("placementid") end for;
return(null)
end