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