这个存储过程有什么问题 [英] What is wrong with this stored procedure

查看:123
本文介绍了这个存储过程有什么问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此存储过程有什么问题。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆