I have a pl/sql procedure on an Oracle 11g that has the following parameters:
PROCEDURE validate_product
( product_id_in IN varchar2 ,
username_in in va
Starting with Oracle 12.2 there is a JDBC Support for Binding PLSQL_BOOLEAN
I'll demonstrate is on a simple procedure with IN
and OUT
BOOLEAN
parameters
create or replace PROCEDURE proc_C (flag_in BOOLEAN, flag_out OUT BOOLEAN) as
begin
flag_out := flag_in;
end;
/
Unfortunately it is not possible to use directly setBoolean
to bind the first parameter.
The driver Version 19.3.0.0.0
returns in this case PLS-00306: wrong number or types of arguments in call to 'PROC_C'
The workaround is simple using setObject(1,true,oracle.jdbc.OracleTypes.PLSQL_BOOLEAN)
The whole example
stmt = con.prepareCall("{ call proc_C(?,?)}")
stmt.setObject(1,false,oracle.jdbc.OracleTypes.PLSQL_BOOLEAN)
stmt.registerOutParameter(2, oracle.jdbc.OracleTypes.PLSQL_BOOLEAN)
stmt.execute()
flag = stmt.getBoolean(2)