“参数类型冲突”在另一个 Java 存储过程中调用 Java 存储过程时
问题是这样的(抱歉英语不好):
我正在使用 JDeveloper 和 Oracle10g,并且我有一个 Java 存储过程正在调用另一个 JSP,如代码:
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();
}
我正在将错误记录在名为 ATESTER 的表中,因为这个 JavaSP是一个过程而不是一个函数,我必须在里面操作DML。
所以,我收到的错误消息是:“参数类型冲突”...
函数“FC_RJS_INCLUIR_RELACAO_PRODCAT”它也是一个Java存储过程,它已经导出到Oracle,并返回一个int变量,我必须读取它决定我将从该 JavaSP 调用哪个 Web 服务。
我已经在registerOutParameter 中尝试过OracleType.NUMBER。
有人知道我做错了什么吗?
Here's the problem (sorry for the bad english):
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();
}
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'...
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.
I have already tried the OracleTyep.NUMBER in the registerOutParameter.
Anyone knows what i'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的调用中似乎缺少一个参数。您注册一个整数输出参数,然后设置 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: