Here is code for an Oracle procedure to be called from Java:
CallableStatement st = connection.prepareCall("{call PROCEDURE_0(?,?,?)}");
st.setInt(1,xyz1);
st.setString(2,xyz2);
st.setInt(3,int_variable);
st.registerOutParameter(3,Types.INTEGER);
try{
st.execute();
}
catch(Exception e){
}
If a user calls System.exit() on this Java JVM - what happens to the Oracle procedure that was called? Is it guaranteed to keep running in Oracle? Or perhaps, in order to guarantee this, I should submit it to the Oracle job scheduler instead? So far, my experience has been that sometimes the procedure keeps running even if the JVM terminates, and sometimes it does not. Does this have anything to do with 'registering an out parameter'? Will the code reach the catch block if System.exit is called?
Does anyone have experience with this?
This code which I stole from Mike McAllister which he also stole from an Oracle forum solves the problem I was mentioning in this question. It works, and you can pass dynamic variables as parameters, not just hard-coded values.
this SO question also addresses the problem:
Passing arguments to oracle stored procedure through scheduler job