pears.GetPlacementTheirRef

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

CREATE FUNCTION "pears"."GetPlacementTheirRef"( 
  /* Application Maintained Function / Procedure - DO NOT EDIT*/
  IN "persid" CHAR(20),IN "vacid" CHAR(20) ) 
RETURNS CHAR(50)
BEGIN
  DECLARE "rv" CHAR(50);
  SET "rv" = NULL;
  "forstat": FOR "forlab" AS "curs" no scroll cursor FOR
    SELECT "placement"."theirref" 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 FOR READ ONLY do
    SET "rv" = "theirref";
    leave "forstat" END FOR;
  IF "trim"("isnull"("rv",'')) = '' THEN
    SELECT "theirref" INTO "rv" FROM "vacancy" WHERE "vacancyid" = "vacid"
  END IF;
  RETURN("rv")
END
  • database/functions/pears_getplacementtheirref.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1