A CallableStatement can return one ResultSet object or multiple ResultSet objects. Multiple ResultSet objects are handled using operations inherited from Statement . For maximum portability, a call's ResultSet objects and update counts should be processed prior to getting the values of output parameters.
What is the use of CallableStatement?
The CallableStatement interface allows the use of SQL statements to call stored procedures. Stored procedures are programs that have a database interface. These programs possess the following: They can have input and output parameters, or parameters that are both input and output.
How do I execute a stored procedure using CallableStatement?
You can execute a stored procedure on the database by calling executeQuery() method of CallableStatement class, as shown below: ResultSet rs = cs. executeQuery(); This will return a ResultSet object which contains rows returned by your stored procedure.