====== pears.GetShiftBookedDescription ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
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