Consider the stored procedure spSample2, which can be executed using the following JDBC API calls:
CallableStatement cstmt = con.prepareCall("CALL spSample2(p1, ?, ?)"); ResultSet rs = cstmt.executeQuery();
The following alternatives can be used for the second line (ResultSet rs = …):
boolean bool = cstmt.execute();
int count = cstmt.executeUpdate();
The QUESTION MARK character indicates an argument and acts as a placeholder for IN or INOUT parameters in the prepareCall() request. The question mark placeholder arguments must be bound with the application local variables and literals using the CallableStatement.setXXX() JDBC API calls.
Alternatively, an IN or INOUT argument can be a constant expression.
The INOUT and OUT arguments need to be registered using the following JDBC API call:
After execution the parameter values can be retrieved from the response using the CallableStatement.getXXX() JDBC API calls.