Wrong number or types of arguments in call to procedure with use zxJDBC

我的未来我决定 提交于 2019-12-11 09:34:33

问题


I took official example from 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: wrong number or types of arguments in call to 'FUNCOUT' ORA-06550: line 1, column 7: PL/SQL: Statement ignored

How to fix it?

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])

回答1:


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?




回答2:


You can take a look at PLSQLSample.java



来源:https://stackoverflow.com/questions/53946480/wrong-number-or-types-of-arguments-in-call-to-procedure-with-use-zxjdbc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!