JDBC CallableStatement interface

The JDBC CallableStatement is used to execute the store procedure and functions. CallableStatement interface provides the methods to execute the store procedure and functions. We can get a statement object by invoking the prepareCall() method of Connection interface.
Syntax: CallableStatement callableStatement = conn.prepareCall(“{call procedurename(?,?…?)}”);
 Note: A store procedure is used to perform business logic and may return zero or more values. A function used to perform calculation and it can return only one value.
Note: PreparedStatement can only use IN parameters. CallableStatement can use both IN and OUT parameters.

JDBC CallableStatement examples:

No comments: