Name

CallableStatement

Synopsis

Interface Name: java.sql.CallableStatement

Superclass: java.sql.PreparedStatement

Immediate Subclasses: None

Interfaces Implemented: None

Availability: JDK 1.1

Description

This extension of the PreparedStatement interface provides support for SQL stored procedures. It specifies methods that handle the binding of output parameters. JDBC prescribes a standard form in which stored procedures should appear independent of the DBMS being used. The format is:

{? = call ...}
{call ...}

Each question mark is a place holder for an input or output parameter. The first syntax provides a single result parameter. The second syntax has no result parameters. The parameters are referred to sequentially with the first question mark holding the place for parameter 1.

Before executing a stored procedure, all output parameters should be registered using the registerOutParameter( ) method. You then bind the input parameters using the various set methods and execute the stored procedure.

Class Summary

public interface CallableStatement extends PreparedStatement {
    Array getArray(int index) throws SQLException;
    BigDecimal getBigDecimal(int index) 
        throws SQLException;
    #BigDecimal getBigDecimal(int index, int scale) 
        throws SQLException;
    Blob getBlob(int index) throws SQLException;
    boolean getBoolean(int index) throws SQLException;
    byte getByte(int index) throws SQLException;
    byte[] getBytes(int index) throws SQLException;
    Clob getClob(int index) throws SQLException;
    java.sql.Date getDate(int ...

Get Database Programming with JDBC & Java, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.