CallableStatement is a JDBC interface used to execute stored procedures and stored functions in a database. It extends the PreparedStatement interface and allows Java applications to call database routines that may contain input parameters, output parameters, or both. The prepareCall() method of the Connection interface is used to create a CallableStatement object. Input values are supplied using methods such as setInt() and setString(), while output parameters are registered using registerOutParameter(). After executing the stored procedure, methods such as getInt() and getString() are used to retrieve the output values.
Methods of CallableStatement
| Method Signature and Short Description |
|---|
|
Registers an OUT parameter with the specified SQL type. |
|
Registers a named OUT parameter with the specified SQL type. |
|
Sets an integer value for the specified input parameter. |
|
Sets a String value for the specified input parameter. |
|
Sets a double value for the specified input parameter. |
|
Sets a float value for the specified input parameter. |
|
Sets a boolean value for the specified input parameter. |
|
Sets an object value for the specified input parameter. |
|
Retrieves the value of an OUT parameter as an integer. |
|
Retrieves the value of an OUT parameter as a String. |
|
Retrieves the value of an OUT parameter as a double. |
|
Retrieves the value of an OUT parameter as an Object. |
|
Retrieves a named OUT parameter as an integer. |
|
Retrieves a named OUT parameter as a String. |
|
Retrieves a named OUT parameter as an Object. |
|
Executes the stored procedure or function associated with the |
|
Retrieves the current result as a |
|
Executes the callable SQL statement and returns the number of affected rows. |
|
Sets the specified input parameter to SQL |
|
Sets a SQL date value for the specified input parameter. |
|
Sets a SQL time value for the specified input parameter. |
|
Sets a timestamp value for the specified input parameter. |
|
Releases the resources held by the |
