pears.GetQuestMultiSelection

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

Original SQL

CREATE FUNCTION "pears"."GetQuestMultiSelection"( IN "stagloc" CHAR(3),IN "stagid" CHAR(3),IN "sparentid" CHAR(20) ) 
RETURNS long VARCHAR
BEGIN
  DECLARE "rv" long VARCHAR;
  SET "rv" = '';
  FOR "fetchfor" AS "fetchcursor" dynamic scroll cursor FOR
    SELECT "string"("tagvalue"."tagchoiceid","char"(9),"tagvalue"."value","char"(13),"char"(10)) AS "chc" FROM "tagvalue" KEY JOIN "tagchoice"
      WHERE "tagvalue"."taglocation" = "stagloc" AND "tagvalue"."id" = "sparentid" AND "tagvalue"."tagid" = "stagid"
      ORDER BY "tagchoice"."sortorder" ASC do
    SET "rv" = "rv"+"chc" END FOR;
  RETURN("rv")
END