CallableStatement Interface

Posted By on April 29, 2016


Download PDF
PreparedStatement Interface
Statement, PreparedStatement & CallableStatement

This interface represents a database stored procedure. You can use it to execute stored procedures in a database server.

To call the stored procedures and functions, CallableStatement interface is used.

We can have business logic on the database by the use of stored procedures and functions that will make the performance better because these are precompiled.

Suppose you need the get the age of the employee based on the date of birth, you may create a function that receives date as the input and returns age of the employee as the output.

 

The differences between stored procedures and functions are given below:

Stored Procedure Function
is used to perform business logic. is used to perform calculation.
must not have the return type. must have the return type.
may return 0 or more values. may return only one values.
We can call functions from the procedure. Procedure cannot be called from function.
Procedure supports input and output parameters Function supports only input parameter.
Exception handling using try/catch block can be used in stored procedures. Exception handling using try/catch can’t be used in user defined functions.
PreparedStatement Interface
Statement, PreparedStatement & CallableStatement

Download PDF