“参数类型冲突";在另一个Java存储过程中调用Java存储过程时 [英] "Parameter type conflict" when calling Java Stored Procedure within another Java Stored Procedure
问题描述
这是问题所在(抱歉英语不好):
Here's the problem (sorry for the bad english):
我正在使用JDeveloper和Oracle10g,并且我有一个Java存储过程正在调用另一个JSP,例如代码:
i'm working with JDeveloper and Oracle10g, and i have a Java Stored Procedure that is calling another JSP like the code:
int sd = 0;
try {
CallableStatement clstAddRel = conn.prepareCall(" {call FC_RJS_INCLUIR_RELACAO_PRODCAT(?,?)} ");
clstAddRel.registerOutParameter(1, Types.INTEGER);
clstAddRel.setString(1, Integer.toString(id_produto_interno));
clstAddRel.setString(2, ac[i].toString());
clstAddRel.execute();
sd = clstAddRel.getInt(1);
} catch(SQLException e) {
String sqlTeste3 = "insert into ateste values (SQ_ATESTE.nextval, ?)";
PreparedStatement pstTeste3 = conn.prepareStatement(sqlTeste3);
pstTeste3.setString(1,"erro: "+e.getMessage()+ ac[i]);
pstTeste3.execute();
pstTeste3.close();
}
我将错误记录在名为ATESTE的表中,因为该JavaSP是一个过程而不是一个函数,我必须在内部操纵DML.
I'm recording the error in a table called ATESTE because this JavaSP is a procedure and not a function, I've to manipulate DML inside.
所以,我收到的错误消息是:参数类型冲突" ...
So, the error message I'm getting is: 'parameter type conflict'...
函数"FC_RJS_INCLUIR_RELACAO_PRODCAT"也是一个Java存储过程,它已经导出到Oracle,并返回一个int变量,我必须阅读此内容才能决定要从此JavaSP调用哪个Web服务.
the function "FC_RJS_INCLUIR_RELACAO_PRODCAT" it's a Java Stored Procedure too, it's already exported to Oracle, and returns an int variable, and i have to read this to decide which webservice i will call from this JavaSP.
我已经在registerOutParameter中尝试过OracleTyep.NUMBER.
I have already tried the OracleTyep.NUMBER in the registerOutParameter.
有人知道我在做什么错吗?
Anyone knows what i'm doing wrong?
推荐答案
似乎您的呼叫中缺少参数.您注册一个整数输出参数,然后设置2个字符串参数.我假设您的过程FC_RJS_INCLUIR_RELACAO_PRODCAT
返回一个整数值.如果是这样,您的代码应该看起来像这样:
It looks like you are missing a parameter in your call. You register an Integer output parameter, and then you set 2 string parameters. I'm presuming your procedure FC_RJS_INCLUIR_RELACAO_PRODCAT
returns an integer value. If so your code should look more like this:
CallableStatement clstAddRel = conn.prepareCall(" { ? = call FC_RJS_INCLUIR_RELACAO_PRODCAT(?,?)} ");
clstAddRel.registerOutParameter(1, Types.INTEGER);
clstAddRel.setString(2, Integer.toString(id_produto_interno));
clstAddRel.setString(3, ac[i].toString());
clstAddRel.execute();
这篇关于“参数类型冲突";在另一个Java存储过程中调用Java存储过程时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!