创建视图中带参数的DB2存储过程 [英] DB2 Store Procedure with Parameters in Create View

查看:402
本文介绍了创建视图中带参数的DB2存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好......


我正在尝试创建一个接收两个参数的存储过程(都是Date)。 SP必须从包含两个JOIN的两个JOIN和三个WHERE条件的Select创建一个View。


我在Windows 7 32位和IBM Data上使用DB2 9.7 FixPack 2 Studio 2.2。


我遇到的问题是,通过部署SP会返回以下错误:

COBR.SP_CREATEVIEWMOVCUSTOMER :17:STARTDATEMONITOR在上下文中无效..使用它的位置SQLCODE = - 206,SQLSTATE = 42703,DRIVER = 3.61.65


我的SP的代码如下:

Hello ...

I''m trying to create a Stored Procedure that receives two parameters (both are Date). The SP must create a View from a Select containing two JOIN and three WHERE conditions involving the two parameters.

I am working with DB2 9.7 FixPack 2 on Windows 7 32-bit and IBM Data Studio 2.2.

The problem I have is that by making the deployment of the SP returns the following error:

COBR.SP_CREATEVIEWMOVCUSTOMER: 17: "STARTDATEMONITOR" is not valid in the context .. Where It is Used SQLCODE =- 206, SQLSTATE = 42703, DRIVER = 3.61.65

The code of my SP is as follows:

展开 | 选择 | Wrap | 行号

推荐答案

DB2存储过程的正确头语法是
The correct header syntax for a DB2 stored procedure is
展开 | 选择 | Wrap | 行号


@Rabbit


你好兔子。


感谢您的观察。我相信DB2既可以接受它,也可以像之前提到的那样。我改变了它,看看这不是问题,结果是一样的。显然DB2没有在SQL语句中将SQL参数识别为有效。


再次感谢您的回复。
@Rabbit
Hi Rabbit.

Thank you for your observation. I believe that DB2 accepts it both ways, and it was previously as you mention it. I changed it to see if this was not the problem and the results were the same. Apparently DB2 is not recognizing the SQL parameters as valid in the SQL sentence.

Thanks again for your response.


好吧,如果它''不是标题,那么它可能是> =。字段名称和大于符号后面应该有一个空格。而且我不认为符号和等号之间应该有空格。
Well, if it''s not the header, then it might be the > =. There should be a space after the field name and the greater than symbol. And I don''t think there should be a space between the symbol and the equal sign.


这篇关于创建视图中带参数的DB2存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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