我正在尝试创建一个存储过程,该过程将根据传递的 ID 简单地返回相关记录。根据研究,我发现了一些导致我像这样制作存储过程的东西:
CREATE PROCEDURE procMessageMembershipSelect1 (membershipnumber char(10))
RETURNING CHAR(10) AS membership_number, SMALLINT as message_id , varchar(200) as
message, CHAR(1) AS target, DATETIME as date_time_creation, DATETIME as
date_time_display;
DEFINE rsMembershipNumber CHAR(10);
DEFINE rsMessageID smallint;
DEFINE rsMessage VARCHAR(200);
DEFINE rsTarget CHAR(1);
DEFINE rsDateTimeCreation datetime;
DEFINE rsDateTimeDisplay datetime;
FOREACH
SELECT membership_number, message_id, message, target,date_time_creation,
date_time_display
INTO rsMembershipNumber, rsMessageID, rsMessage, rsTarget, rsDateTimeCreation,
rsDateTimeDisplay
FROM MessageMembership
WHERE membership_number = membershipnumber
ORDER BY date_time_display
RETURN rsMembershipNumber, rsMessageID rsMessage, rsTarget, rsDateTimeCreation,
rsDateTimeDisplay WITH RESUME;
END FOREACH
END PROCEDURE;
你能帮我吗?