O'Reilly logo

Database Programming with JDBC & Java, Second Edition by George Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required