T
terryapp
Unregistered / Unconfirmed
GUEST, unregistred user!
存储函数如下:
FUNCTION my_test(in_test1 IN CHAR,
in_test2 IN BOOLEAN,
out_test3 OUT VARCHAR) RETURN VARCHAR IS
v_test CHAR(3) := '';
begin
select 'aaa' into v_test from dual;
Return 'OK';
EXCEPTION
WHEN OTHERS then
out_test3 := SQLCODE;
Return SQLCODE;
end;
Java代码如下:
try {
clstmt = conn.prepareCall("{? = call my_test(?,?,?)}"
clstmt.registerOutParameter(1, Types.VARCHAR);
clstmt.setString(2, "1111111"
clstmt.setBoolean(3, false);
clstmt.registerOutParameter(4, Types.VARCHAR);
clstmt.execute();
} catch (SQLException e) {
System.out.println(e.getMessage());
}
一个简单的调用,报错:
ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'MY_TEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
只知道可能是setBoolean有问题,请教各位做Java的tx,谢谢。
FUNCTION my_test(in_test1 IN CHAR,
in_test2 IN BOOLEAN,
out_test3 OUT VARCHAR) RETURN VARCHAR IS
v_test CHAR(3) := '';
begin
select 'aaa' into v_test from dual;
Return 'OK';
EXCEPTION
WHEN OTHERS then
out_test3 := SQLCODE;
Return SQLCODE;
end;
Java代码如下:
try {
clstmt = conn.prepareCall("{? = call my_test(?,?,?)}"
clstmt.registerOutParameter(1, Types.VARCHAR);
clstmt.setString(2, "1111111"
clstmt.setBoolean(3, false);
clstmt.registerOutParameter(4, Types.VARCHAR);
clstmt.execute();
} catch (SQLException e) {
System.out.println(e.getMessage());
}
一个简单的调用,报错:
ORA-06550: line 1, column 13:
PLS-00306: wrong number or types of arguments in call to 'MY_TEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
只知道可能是setBoolean有问题,请教各位做Java的tx,谢谢。