I have a procedure which is working fine when i run on sql developer.
create or replace
PROCEDURE test(Order in varchar,Id in number ,status out varchar) As
logic
dbms_output.put_line(status);
end;
However when i am calling this procedure from java it showing error ORA-00911: invalid character.My java code is
String proc3StoredProcedure=null;
try {
proc3StoredProcedure = "{ test(?,?,?) }";
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("exception");
e.printStackTrace();
}
CallableStatement cs = conn.prepareCall(proc3StoredProcedure);
cs.setEscapeProcessing(false);
cs.setString(1,"17");
cs.setInt(2,37);
cs.registerOutParameter(3, java.sql.Types.VARCHAR);
cs.execute();
String param4 = cs.getString(2);
System.out.println("param4=" + param4);
conn.close();
}
What I am doing wrong in java code.I have tried many things but its not wroking.Can anyone help me?
Change the string assigned to proc3StoredProcedure
to { call test(?,?,?) }
.
Docs for JDBC SQL escape syntax here. (The syntax for procedure calls is at the very bottom of the linked page).