Home Java Calling a Stored Procedure with Parameters using Jdbc

Calling a Stored Procedure with Parameters using Jdbc

5 min read
0
0
68

Callable statement consist of three parameters  we used the form with a result parameter, which means that we must set it as an OUT parameter.

To clarify I have numbered the parameters:

Authors is Stored procedure name it takes three parameters.i clearly explain below.

{call authors(?,?,?)}
                      1 2 3
                      In out

 

Above example takes the first one in IN parameter, the second and third are OUT parameters and returns a result.

Therefore the correct way to call it is:

Create a CallableStatement object to call the store procedure.

 CallableStatement stat1 = con.prepareCall(“{call authors(?,?,?)}”);

Parameter 1 is an IN-only parameter the stored procedure doesn’t return any other value besides the OUT-parameters.

To read the result from the OUT-parameters we also have to adapt the parameter numbers:

i have attach the full Code below.

I have attached the video tutorial below it will help you  to do this  step by step.

 

 

 

Load More Related Articles
Load More By admin
Load More In Java

Leave a Reply

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

Check Also

Vehicle Petrol Shop Inventory System using Php

The Vehicle Petrol Shop Inventory System is developed using php. The project is built to m…