JDBC - Callable Statement (Stored Procedure)

Jdbc Class Architecture


The CallableStatement objects interface adds methods to the statement interface for retrieving output parameter values returned from stored procedures.

See CallableStatement objects


CallableStatement objects may take three types of parameters: IN, OUT, and INOUT.

CallableStatement object for calling the stored procedure ‘validate’, which has a return parameter and two other parameters.


CallableStatement cstmt = conn.prepareCall(
“{? = call validate(?, ?)}”);

CallableStatement cstmt = con.prepareCall(
"{CALL PROC(?, "Literal_Value", ?)}");
cstmt.setString(1, "First");
cstmt.setString(2, "Third");

// out parameter
cstmt.registerOutParameter(1, java.sql.Types.STRING);
cstmt.registerOutParameter(2, java.sql.Types.FLOAT);
// Retrieve OUT parameters
String name = cstmt.getString(1);
float number = cstmt.getFloat(2);

// the two parameter markers have the ordinal values 1 and 2.
cstmt.setFloat("PARAM_5", 150.25);

Discover More
Jdbc Class Architecture
JDBC - Batch (Update|Statement) (DML|DDL)

The batch update facility allows multiple SQL statements to be submitted to a data source for processing at once. Submitting multiple SQL statements, instead of individually, can greatly improve performance....
Jdbc Class Architecture
Jdbc - Statement

Statement objects are created by Connection objects The java/sql/StatementStatement interface defines methods for executing SQL statements. There is also two subclasses: The PreparedStatement interface...

Share this page:
Follow us:
Task Runner