使用zxJDBC的过程调用中参数的数量或类型错误 [英] Wrong number or types of arguments in call to procedure with use zxJDBC

查看:171
本文介绍了使用zxJDBC的过程调用中参数的数量或类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 http://www.jython.org/获取了官方示例archive/21/docs/zxjdbc.html :

Oracle
>>> c = db.cursor() # open the database as in the examples above
>>> c.execute("create or replace function funcout (y out varchar2) return varchar2 is begin y := 'tested'; return 'returned'; end;")
>>> params = [None]
>>> c.callproc("funcout", params)
>>> print params

运行此代码时出现异常:

When I run this code I get exception:

PLS-00306:调用"FUNCOUT"时参数的数量或类型错误 ORA-06550:第1行,第7列:PL/SQL:语句已忽略

PLS-00306: wrong number or types of arguments in call to 'FUNCOUT' ORA-06550: line 1, column 7: PL/SQL: Statement ignored

如何解决?

加法!!!此代码也不起作用:

Addition!!! Also does not work this code:

  outParam = ""
            self.cursor.execute("create or replace function funcout (y out varchar2) return varchar2 is begin y := 'tested'; return 'returned'; end;")
            self.cursor.callproc("funcout", [outParam])

推荐答案

当您有OUT或IN OUT参数时,必须传递变量,而不是该参数的文字.该过程还可以如何将值传回?

When you have an OUT or IN OUT parameter, you must pass a variable, not a literal for that parameter. How else can the procedure pass the value back?

这篇关于使用zxJDBC的过程调用中参数的数量或类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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