CallableStatement in JDBC

CallableStatement is used to call the stored procedures and functions.

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.

CallableStatement extends PreparedStatement. So it has all the benefits of PreparedStatement.

Let’s create the below procedure in the DB.

Screen Shot 2020-02-08 at 7.15.11 PM

DB before program execution

Screen Shot 2020-02-08 at 6.42.22 PM

Let’s call the above procedure in our java class using CallableStatement by passing the arguments. Here, also we can use batch processing.



Screen Shot 2020-02-08 at 7.12.05 PM

DB after program execution

Screen Shot 2020-02-08 at 7.11.52 PM

Leave a Reply

Your email address will not be published. Required fields are marked *