SET TERM ^ ;

/* Stored procedures */
CREATE PROCEDURE MRU_SURVEYID AS BEGIN EXIT; END ^
CREATE PROCEDURE NXT_SURVEYID AS BEGIN EXIT; END ^
CREATE PROCEDURE MRU_QUESTIONID AS BEGIN EXIT; END ^
CREATE PROCEDURE NXT_QUESTIONID AS BEGIN EXIT; END ^

ALTER PROCEDURE MRU_SURVEYID RETURNS (MRU INTEGER)
AS 
BEGIN
  mru= GEN_ID(GEN_SURVEYID,0);
END
 ^

ALTER PROCEDURE NXT_SURVEYID RETURNS (NXT INTEGER)
AS
BEGIN
  nxt= GEN_ID(GEN_SURVEYID,1);
END
 ^

ALTER PROCEDURE MRU_QUESTIONID RETURNS (MRU INTEGER)
AS
BEGIN
  mru= GEN_ID(GEN_QUESTIONID,0);
END
 ^

ALTER PROCEDURE NXT_QUESTIONID RETURNS (NXT INTEGER)
AS
BEGIN
  nxt= GEN_ID(GEN_QUESTIONID,1);
END
 ^
SET TERM ; ^

COMMIT;

GRANT EXECUTE ON PROCEDURE MRU_QUESTIONID TO SURVEY_USER;
GRANT EXECUTE ON PROCEDURE MRU_SURVEYID TO SURVEY_USER;
GRANT EXECUTE ON PROCEDURE NXT_QUESTIONID TO SURVEY_USER;
GRANT EXECUTE ON PROCEDURE NXT_SURVEYID TO SURVEY_USER;

COMMIT;

