DB2动态SQL CUESOR

发布于 2025-02-03 08:42:22 字数 554 浏览 3 评论 0原文

我可以在DB2光标中使用两个参数,然后使用:PARM1:PARM2打开它 我的COBOL源是:

working-storage
01 parm1 pic x(09).
01 parm2 pic x(09).
procedure division.
move '080000' to parm1.
move '090000' to parm2.
move 'select s2p from grp2.arz where s2p > ? and < ?' to st.

然后我准备它:

exec-sql parepare s1 from :st statement1 end-exec.
exec-sql declare c1 vursor for s1 end-exec.
exec-sql open c1 using :parm1 :parm2 end-exec.

然后我从光标中获取。

在运行时间我有错误:

指示器变量PARM2不是小型类型!

can I use two parameters in db2 cursor and open it using :parm1 :parm2
my cobol source is:

working-storage
01 parm1 pic x(09).
01 parm2 pic x(09).
procedure division.
move '080000' to parm1.
move '090000' to parm2.
move 'select s2p from grp2.arz where s2p > ? and < ?' to st.

and then I prepare it:

exec-sql parepare s1 from :st statement1 end-exec.
exec-sql declare c1 vursor for s1 end-exec.
exec-sql open c1 using :parm1 :parm2 end-exec.

and then I fetch from the cursor.

In run time I got error:

indicator variable parm2 is not smallint type!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

A君 2025-02-10 08:42:22

使用在中传递的参数必须由逗号分隔:

exec-sql open c1 using :parm1, :parm2 end-exec.

没有逗号DB2将其解释为一对主机变量和无效的指示灯。

The parameters passed in using have to separated by a comma:

exec-sql open c1 using :parm1, :parm2 end-exec.

Without the comma DB2 is interpreting it as a pair of host-variable and null-indicator.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文