Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
CREATE FUNCTION "pears"."GetQuestSingleSelection"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ IN "stagloc" CHAR(3),IN "stagid" CHAR(3),IN "sparentid" CHAR(20) ) RETURNS CHAR(4) BEGIN DECLARE "rv" CHAR(4); SET "rv" = NULL; SELECT "max"("tagchoiceid") INTO "rv" FROM "tagvalue" WHERE "taglocation" = "stagloc" AND "id" = "sparentid" AND "tagid" = "stagid"; IF "rv" IS NULL THEN SET "rv" = '_' END IF; RETURN("rv") END