The CallableStatement : CallableStatement « Database « Java Tutorial






  1. The CallableStatement extends the PreparedStatement interface.
  2. The CallableStatement provides an interface for calling database stored procedures.

the simplest form of this syntax would be:

{call procedure-name}

which represents a call to a stored procedure with no parameters. A call to a stored procedure accepting two input parameters:

{call procedure-name (?, ?)}

    CallableStatement callproc = connection.prepareCall("{call updateLast (?, ?)}");
    callproc.setInt (1, 5);          // 1 specifies the first parameter
    callproc.setString (2, "J");     // 2 specifies the second parameter

To now execute the stored procedure, we use the following statement:

callproc.executeUpdate();








20.16.CallableStatement
20.16.1.The CallableStatement