pears.GetQuestSubMenuSelection

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

Original SQL

CREATE FUNCTION "pears"."GetQuestSubMenuSelection"( 
  /* Application Maintained Function / Procedure - DO NOT EDIT*/
  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"(
      (SELECT "cc"."description" FROM "tagchoice" AS "cc"
        WHERE "cc"."tagid" = "c"."tagid" AND "cc"."taglocation" = "c"."taglocation" AND "cc"."tagchoiceid" = "c"."tagchoiceparentid"),
      "char"(9),"c"."description","char"(13),"char"(10)) AS "chc"
      FROM "tagvalue" AS "v" KEY JOIN "tagchoice" AS "c"
      WHERE "v"."taglocation" = "stagloc" AND "V"."id" = "sparentid" AND "v"."tagid" = "stagid"
      ORDER BY "c"."sortorder" ASC do
    SET "rv" = "rv"+"chc" END FOR;
  RETURN("rv")
END