这个存储过程有什么问题 [英] What is wrong with this stored procedure
问题描述
此存储过程有什么问题。
What is wrong with this stored procedure.
CREATE PROCEDURE PROC_RESULT_SET ()
LANGUAGE SQL
RESULT SETS 1
BEGIN
DECLARE MYCUR CURSOR WITH RETURN FOR
SELECT USERNAME , NAME FROM SLPG.USER ORDER BY ID;
OPEN MYCUR;
END;
我收到类似
DB2 for Linux,UNIX和Windows:END预期形成一个完整的范围。 - 靠近BEGIN语句
DB2 for Linux, UNIX, and Windows: "END" was expected to form a complete scope. -- near BEGIN statement
DB2 for Linux,UNIX和Windows:预期形成一个完整的范围。 - 接近DECLARE语句
DB2 for Linux, UNIX, and Windows: "" was expected to form a complete scope. -- near DECLARE statement
DB2 for Linux,UNIX和Windows:JOIN预期形成一个完整的范围。 - 靠近OPEN语句
DB2 for Linux, UNIX, and Windows: " JOIN " was expected to form a complete scope. -- near OPEN statement
DB2 for Linux,UNIX和Windows:遇到意外的文本END。 - near END statement
DB2 for Linux, UNIX, and Windows: Unexpected text "END" encountered. -- near END statement
推荐答案
您需要为 CREATE PROCEDURE
语句本身,因为分号用于终止过程体中的语句。
You need to use a different terminator for the CREATE PROCEDURE
statement itself, as the semicolon is used to terminate statements within the procedure body.
这篇关于这个存储过程有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!