I created this package as follows:
create or replace package trypa is
function e(tryp boolean) return number;
end trypa;
/
create or replace package body trypa is
function e(tryp boolean) return number
as
begin
return 1;
end;
end trypa;
then I created a java file like this:
package test;
public class readData {
public static void main(String[] args) {
try {
Connect connPool = new Connect();
Connection myConn = connPool.getConnection();
CallableStatement cs = myConn.prepareCall("{?=call trypa.e(?)}");
cs.registerOutParameter(1,OracleTypes.NUMBER);
boolean b;
b = true;
cs.setBoolean(2,b);
cs.execute();
}
catch (Exception e)
{
System.out.println("error1:"+e.getMessage());
}
}
}
But an error occured.
error1:ORA-06550: 第 1 行, 第 13 列:
PLS-00306: 调用 'E' 时参数数量或类型错误
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignored
I use Chinese Version. The error is parameter counts error or type error.
If I replace boolean to number, it works well.
How can I transfer a boolean variable?
Please help
thanks
Bookmarks