O'Reilly logo

Java Enterprise in a Nutshell, Second Edition by David Flanagan, Jim Farley, William Crawford

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

The CallableStatement interface allows programs to access SQL stored procedures within the database. You create a CallableStatement with the prepareCall() method of Connection. Question mark characters (?) are used as placeholders for input and output values in the syntax used to call stored procedures:

{? = call procedure_name[(?[,?...])]}{call procedure_name[(?[,?...])]}

Parameters are numbered sequentially starting from 1. Input parameters are set with the same setXXX() methods as in a PreparedStatement. Output parameters must be registered using the registerOutParameter() methods, and may be retrieved after the statement executes using the getXXX() methods, which are identical to those in ResultSet. To execute a statement, you call execute(), which is inherited from PreparedStatement.

                  Returned By
public interface CallableStatement extends PreparedStatement {
// Public Instance Methods
   public abstract java.sql.Array getArray(                      // 1.2
        int i) throws SQLException;  
   public abstract java.sql.Array getArray(                      // 1.4
        String parameterName) throws SQLException;  
   public abstract java.math.BigDecimal getBigDecimal(           // 1.2
        int parameterIndex) throws SQLException;  
   public abstract java.math.BigDecimal getBigDecimal(           // 1.4
        String parameterName) throws SQLException;  
   public abstract Blob getBlob(                                 // 1.4
        String parameterName) throws SQLException;  
   public abstract Blob getBlob( 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