I want to call the Oracle Sql functions using java. But I am getting error
java.sql.SQLException: Missing IN or OUT parameter at index:: 4
Can any body please help me regarding this?
Below are the statments for reading Oracle SQL Function.
DECLARE
ID VARCHAR2(10);
date1 DATE;
output PL/SQL RECORD;
BEGIN
ID := '1234';
date1 := to_date('2018-05-15','yyyy-MM-dd');
output := Function1(
ID => I_EMPL_ID,
date1 => I_BALANCE_DATE
);
END;
Here below is the code I used in java for calling function:
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MMM-yy");
Date now = new java.sql.Date(simpleDateFormat.parse("17-MAY-18").getTime());
CallableStatement cstmt = con.prepareCall("{? = call Function1(?,?,?)}");
cstmt.setString(1, "1234");
cstmt.setDate(2, now);
cstmt.registerOutParameter(3, Types.ROWID);
cstmt.execute();
When I execute this code, I am getting the below error:
java.sql.SQLException: Missing IN or OUT parameter at index:: 4
Can anybody help me regarding this?
?.