Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
CREATE FUNCTION "pears"."GetShiftBookedDescription"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ IN "vid" CHAR(20),IN "pid" CHAR(20),IN "edate" DATE ) RETURNS CHAR(250) BEGIN DECLARE "rv" CHAR(250); FOR "fetchfor" AS "fetchcursor" no scroll cursor FOR SELECT "string"("GetTempName"("pid"),' (',"tempshiftplan"."description",',',"dateformat"("tempshift"."timefrom",'hh:nn'),'-',"dateformat"("tempshift"."timeto",'hh:nn'),')') AS "bdesc" FROM "tempshift" KEY JOIN("vacancy","tempshiftplan","person") WHERE "vacancy"."vacancyid" = "vid" AND "tempshift"."shiftdate" = "edate" AND "tempshift"."personid" = "pid" AND "tempshift"."state" NOT IN( 'U','C' ) ORDER BY "tempshift"."timefrom" ASC,"person"."keyname" ASC FOR READ ONLY do IF "rv" <> '' THEN SET "rv" = "rv"+"bdesc"+', ' END IF; SET "rv" = "rv"+"bdesc" END FOR; RETURN "rv" END