public interface CallableStatement extends PreparedStatement
The JDBC API provides an SQL escape syntax allowing Stored Procedures
to be called in a standard way for all databases. The JDBC escape syntax has
two forms. One form includes a result parameter. The second form does not
include a result parameter. Where the result parameter is used, it must be
declared as an OUT
parameter. Other parameters can be declared as
IN
, OUT
, or INOUT
. Parameters are referenced either by
name or by a numerical index starting at 1.
The correct syntax is:
IN
parameters are set before calling the procedure,
using the setter methods which are inherited from PreparedStatement
.
For OUT
parameters, their type must be registered before executing
the stored procedure. The values are retrieved using the getter methods
defined in the CallableStatement
interface.
CallableStatement
s can return one or more ResultSets
. In the
event that multiple ResultSets
are returned, they are accessed using
the methods inherited from the Statement
interface.
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
Modifier and Type | Method and Description |
---|---|
Array |
getArray(int parameterIndex)
Gets the value of a specified JDBC
ARRAY parameter as a
java.sql.Array . |
Array |
getArray(String parameterName)
Gets the value of a specified JDBC
ARRAY parameter as a java.sql.Array . |
BigDecimal |
getBigDecimal(int parameterIndex)
Returns a new
BigDecimal representation of the JDBC NUMERIC parameter specified by the input index. |
BigDecimal |
getBigDecimal(int parameterIndex,
int scale)
Deprecated.
|
BigDecimal |
getBigDecimal(String parameterName)
Returns a new
BigDecimal representation of the JDBC NUMERIC parameter specified by the input name. |
Blob |
getBlob(int parameterIndex)
Gets the value of a specified JDBC
BLOB parameter as a java.sql.Blob . |
Blob |
getBlob(String parameterName)
Gets the value of a specified JDBC
BLOB parameter as a java.sql.Blob . |
boolean |
getBoolean(int parameterIndex)
Gets the value of a specified JDBC
BIT parameter as a boolean. |
boolean |
getBoolean(String parameterName)
Gets the value of a specified JDBC
BIT parameter as a boolean . |
byte |
getByte(int parameterIndex)
Gets the value of a specified JDBC
TINYINT parameter as a byte . |
byte |
getByte(String parameterName)
Gets the value of a specified JDBC
TINYINT parameter as a Java
byte . |
byte[] |
getBytes(int parameterIndex)
Returns a byte array representation of the indexed JDBC
BINARY or
VARBINARY parameter. |
byte[] |
getBytes(String parameterName)
Returns a byte array representation of the named JDBC
BINARY or
VARBINARY parameter. |
Reader |
getCharacterStream(int parameterIndex)
Returns the value of the specified parameter as a
java.io.Reader . |
Reader |
getCharacterStream(String parameterName)
Returns the value of the specified parameter as a
java.io.Reader . |
Clob |
getClob(int parameterIndex)
Gets the value of a specified JDBC
CLOB parameter as a java.sql.Clob . |
Clob |
getClob(String parameterName)
Gets the value of a specified JDBC
CLOB parameter as a java.sql.Clob . |
Date |
getDate(int parameterIndex)
Gets the value of the specified JDBC
DATE parameter as a java.sql.Date . |
Date |
getDate(int parameterIndex,
Calendar cal)
Gets the value of the specified JDBC
DATE parameter as a java.sql.Date , using the specified Calendar to construct the date. |
Date |
getDate(String parameterName)
Gets the value of the specified JDBC
DATE parameter as a java.sql.Date . |
Date |
getDate(String parameterName,
Calendar cal)
Gets the value of the specified JDBC
DATE parameter as a java.sql.Date , using the specified Calendar to construct the date. |
double |
getDouble(int parameterIndex)
Gets the value of the specified JDBC
DOUBLE parameter as a
double . |
double |
getDouble(String parameterName)
Gets the value of the specified JDBC
DOUBLE parameter as a
double . |
float |
getFloat(int parameterIndex)
Gets the value of the specified JDBC
FLOAT parameter as a float . |
float |
getFloat(String parameterName)
Gets the value of the specified JDBC
FLOAT parameter as a Java
float . |
int |
getInt(int parameterIndex)
Gets the value of the specified JDBC
INTEGER parameter as an
int . |
int |
getInt(String parameterName)
Gets the value of the specified JDBC
INTEGER parameter as an
int . |
long |
getLong(int parameterIndex)
Gets the value of the specified JDBC
BIGINT parameter as a
long . |
long |
getLong(String parameterName)
Gets the value of the specified JDBC
BIGINT parameter as a
long . |
Reader |
getNCharacterStream(int parameterIndex)
Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter
as a
Reader . |
Reader |
getNCharacterStream(String parameterName)
Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter as a
java.io.Reader . |
NClob |
getNClob(int parameterIndex)
Returns the value of the specified SQL NCLOB parameter as a
java.sql.NClob . |
NClob |
getNClob(String parameterName)
Returns the value of the specified SQL NCLOB parameter as a
java.sql.NClob . |
String |
getNString(int parameterIndex)
Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter as a
java.lang.String . |
String |
getNString(String parameterName)
Returns the value of the specified SQL NCHAR, NVARCHAR, or LONGNVARCHAR parameter as a
java.lang.String . |
Object |
getObject(int parameterIndex)
Gets the value of the specified parameter as a Java
Object . |
Object |
getObject(int parameterIndex,
Map<String,Class<?>> map)
Gets the value of the specified parameter as an
Object . |
Object |
getObject(String parameterName)
Gets the value of the specified parameter as an
Object . |
Object |
getObject(String parameterName,
Map<String,Class<?>> map)
Gets the value of a specified parameter as an
Object . |
Ref |
getRef(int parameterIndex)
Gets the value of a specified SQL
REF(<structured type>)
parameter as a java.sql.Ref . |
Ref |
getRef(String parameterName)
Gets the value of a specified SQL
REF(<structured type>)
parameter as a java.sql.Ref . |
RowId |
getRowId(int parameterIndex)
Gets the value of a specified
ROWID parameter as a java.sql.RowId . |
RowId |
getRowId(String parameterName)
Returns the value of the specified SQL ROWID parameter as a
java.sql.RowId . |
short |
getShort(int parameterIndex)
Gets the value of a specified JDBC
SMALLINT parameter as a
short . |
short |
getShort(String parameterName)
Gets the value of a specified JDBC
SMALLINT parameter as a
short . |
SQLXML |
getSQLXML(int parameterIndex)
Returns the value of the specified SQL XML parameter as a
java.sql.SQLXML . |
SQLXML |
getSQLXML(String parameterName)
Returns the value of the specified SQL XML parameter as a
java.sql.SQLXML . |
String |
getString(int parameterIndex)
Returns the indexed parameter's value as a
String . |
String |
getString(String parameterName)
Returns the named parameter's value as a string.
|
Time |
getTime(int parameterIndex)
Gets the value of a specified JDBC
TIME parameter as a java.sql.Time . |
Time |
getTime(int parameterIndex,
Calendar cal)
Gets the value of a specified JDBC
TIME parameter as a java.sql.Time , using the supplied Calendar to construct the
time. |
Time |
getTime(String parameterName)
Gets the value of a specified JDBC
TIME parameter as a java.sql.Time . |
Time |
getTime(String parameterName,
Calendar cal)
Gets the value of a specified JDBC
TIME parameter as a java.sql.Time , using the supplied Calendar to construct
the time. |
Timestamp |
getTimestamp(int parameterIndex)
Returns the indexed parameter's
TIMESTAMP value as a java.sql.Timestamp . |
Timestamp |
getTimestamp(int parameterIndex,
Calendar cal)
Returns the indexed parameter's
TIMESTAMP value as a java.sql.Timestamp . |
Timestamp |
getTimestamp(String parameterName)
Returns the named parameter's
TIMESTAMP value as a java.sql.Timestamp . |
Timestamp |
getTimestamp(String parameterName,
Calendar cal)
Returns the indexed parameter's
TIMESTAMP value as a java.sql.Timestamp . |
URL |
getURL(int parameterIndex)
Gets the value of a specified JDBC
DATALINK parameter as a
java.net.URL . |
URL |
getURL(String parameterName)
Returns the named parameter's JDBC
DATALINK value in a new Java
java.net.URL . |
void |
registerOutParameter(int parameterIndex,
int sqlType)
Defines the type of a specified
OUT parameter. |
void |
registerOutParameter(int parameterIndex,
int sqlType,
int scale)
Defines the Type of a specified
OUT parameter. |
void |
registerOutParameter(int paramIndex,
int sqlType,
String typeName)
Defines the Type of a specified
OUT parameter. |
void |
registerOutParameter(String parameterName,
int sqlType)
Defines the Type of a specified
OUT parameter. |
void |
registerOutParameter(String parameterName,
int sqlType,
int scale)
Defines the Type of a specified
OUT parameter. |
void |
registerOutParameter(String parameterName,
int sqlType,
String typeName)
Defines the Type of a specified
OUT parameter. |
void |
setAsciiStream(String parameterName,
InputStream x)
Sets the named parameter to the bytes from the given
reader . |
void |
setAsciiStream(String parameterName,
InputStream theInputStream,
int length)
Sets the value of a specified parameter to the content of a supplied
InputStream , which has a specified number of bytes. |
void |
setAsciiStream(String parameterName,
InputStream x,
long length)
Sets the named parameter to the next
length bytes from the given inputStream . |
void |
setBigDecimal(String parameterName,
BigDecimal theBigDecimal)
Sets the value of a specified parameter to a supplied
java.math.BigDecimal value. |
void |
setBinaryStream(String parameterName,
InputStream x)
Sets the named parameter to the bytes from the given
reader . |
void |
setBinaryStream(String parameterName,
InputStream theInputStream,
int length)
Sets the value of a specified parameter to the content of a supplied
binary
InputStream , which has a specified number of bytes. |
void |
setBinaryStream(String parameterName,
InputStream x,
long length)
Sets the named parameter to the next
length bytes from the given inputStream . |
void |
setBlob(String parameterName,
Blob blob)
Sets the named parameter to the given
blob . |
void |
setBlob(String parameterName,
InputStream inputStream)
Sets the named parameter to the bytes from the given
inputStream . |
void |
setBlob(String parameterName,
InputStream inputStream,
long length)
Sets the named parameter to the next
length bytes from the given inputStream . |
void |
setBoolean(String parameterName,
boolean theBoolean)
Sets the value of a specified parameter to a supplied
boolean
value. |
void |
setByte(String parameterName,
byte theByte)
Sets the value of a specified parameter to a supplied
byte value. |
void |
setBytes(String parameterName,
byte[] theBytes)
Sets the value of a specified parameter to a supplied array of bytes.
|
void |
setCharacterStream(String parameterName,
Reader reader)
Sets the named parameter to the characters from the given
reader . |
void |
setCharacterStream(String parameterName,
Reader reader,
int length)
Sets the value of a specified parameter to the character content of a
Reader object, with the specified length of character data. |
void |
setCharacterStream(String parameterName,
Reader reader,
long length)
Sets the named parameter to the next
length characters from the given reader . |
void |
setClob(String parameterName,
Clob clob)
Sets the named parameter to the given
clob . |
void |
setClob(String parameterName,
Reader reader)
Sets the named parameter to the characters from the given
reader . |
void |
setClob(String parameterName,
Reader reader,
long length)
Sets the named parameter to the next
length characters from the given reader . |
void |
setDate(String parameterName,
Date theDate)
Sets the value of a specified parameter to a supplied
java.sql.Date value. |
void |
setDate(String parameterName,
Date theDate,
Calendar cal)
Sets the value of a specified parameter to a supplied
java.sql.Date value, using a supplied calendar to map the date. |
void |
setDouble(String parameterName,
double theDouble)
Sets the value of a specified parameter to a supplied
double
value. |
void |
setFloat(String parameterName,
float theFloat)
Sets the value of a specified parameter to to a supplied
float
value. |
void |
setInt(String parameterName,
int theInt)
Sets the value of a specified parameter to a supplied
int value. |
void |
setLong(String parameterName,
long theLong)
Sets the value of a specified parameter to a supplied
long value. |
void |
setNCharacterStream(String parameterName,
Reader value)
Sets the named parameter to the characters from the given
reader . |
void |
setNCharacterStream(String parameterName,
Reader reader,
long length)
Sets the named parameter to the characters from the given
reader . |
void |
setNClob(String parameterName,
NClob nclob)
Sets the named parameter to the given
nclob . |
void |
setNClob(String parameterName,
Reader reader)
Sets the named parameter to the characters from the given
reader . |
void |
setNClob(String parameterName,
Reader reader,
long length)
Sets the named parameter to the next
length characters from the given reader . |
void |
setNString(String parameterName,
String string)
Sets the named parameter to the given
string . |
void |
setNull(String parameterName,
int sqlType)
Sets the value of a specified parameter to SQL
NULL . |
void |
setNull(String parameterName,
int sqlType,
String typeName)
Sets the value of a specified parameter to be SQL
NULL where the
parameter type is either REF or user defined (e.g. |
void |
setObject(String parameterName,
Object theObject)
Sets the value of a specified parameter using a supplied object.
|
void |
setObject(String parameterName,
Object theObject,
int targetSqlType)
Sets the value of a specified parameter using a supplied object.
|
void |
setObject(String parameterName,
Object theObject,
int targetSqlType,
int scale)
Sets the value of a specified parameter using a supplied object.
|
void |
setRowId(String parameterName,
RowId rowId)
Sets the named parameter to the given
rowId . |
void |
setShort(String parameterName,
short theShort)
Sets the value of a specified parameter to a supplied
short
value. |
void |
setSQLXML(String parameterName,
SQLXML sqlXml)
Sets the named parameter to the given
sqlXml . |
void |
setString(String parameterName,
String theString)
Sets the value of a specified parameter to a supplied
String . |
void |
setTime(String parameterName,
Time theTime)
Sets the value of the parameter named
parameterName to the value
of the supplied java.sql.Time . |
void |
setTime(String parameterName,
Time theTime,
Calendar cal)
Sets the value of the parameter named
parameterName to the value
of the supplied java.sql.Time using the supplied calendar. |
void |
setTimestamp(String parameterName,
Timestamp theTimestamp)
Sets the value of a specified parameter to a supplied
java.sql.Timestamp value. |
void |
setTimestamp(String parameterName,
Timestamp theTimestamp,
Calendar cal)
Sets the value of a specified parameter to a supplied
java.sql.Timestamp value, using the supplied calendar. |
void |
setURL(String parameterName,
URL theURL)
Sets the value of a specified parameter to the supplied
java.net.URL . |
boolean |
wasNull()
Gets whether the value of the last
OUT parameter read was SQL
NULL . |
addBatch, clearParameters, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
addBatch, cancel, clearBatch, clearWarnings, close, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
isWrapperFor, unwrap
Array getArray(int parameterIndex) throws SQLException
ARRAY
parameter as a
java.sql.Array
.parameterIndex
- the parameter index, where the first parameter has
index 1.java.sql.Array
containing the parameter value.SQLException
- if a database error occurs.Array getArray(String parameterName) throws SQLException
ARRAY
parameter as a java.sql.Array
.parameterName
- the desired parameter's name.java.sql.Array
containing the parameter's value.SQLException
- if there is a problem accessing the database.BigDecimal getBigDecimal(int parameterIndex) throws SQLException
BigDecimal
representation of the JDBC NUMERIC
parameter specified by the input index.parameterIndex
- the parameter number index where the first parameter has index
1.java.math.BigDecimal
representing the value of the
specified parameter. The value null
is returned if
the parameter in question is an SQL NULL
.SQLException
- if a database error occurs.@Deprecated BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
BigDecimal
representation of the JDBC NUMERIC
parameter specified by the input index. The number of digits
after the decimal point is specified by scale
.parameterIndex
- the parameter number index, where the first parameter has
index 1.scale
- the number of digits after the decimal point to get.java.math.BigDecimal
representing the value of the
specified parameter. The value null
is returned if
the parameter in question is an SQL NULL
.SQLException
- if a database error occurs.BigDecimal getBigDecimal(String parameterName) throws SQLException
BigDecimal
representation of the JDBC NUMERIC
parameter specified by the input name.parameterName
- the desired parameter's name.java.math.BigDecimal
representing the value of the
specified parameter. The value null
is returned if
the parameter in question is an SQL NULL
.SQLException
- if a database error occurs.Blob getBlob(int parameterIndex) throws SQLException
BLOB
parameter as a java.sql.Blob
.parameterIndex
- the parameter number index, where the first parameter has
index 1.java.sql.Blob
representing the value of the
specified parameter. The value null
is returned if
the parameter in question is an SQL NULL
.SQLException
- if a database error occurs.Blob getBlob(String parameterName) throws SQLException
BLOB
parameter as a java.sql.Blob
.parameterName
- the desired parameter's name.java.sql.Blob
representing the value of the
specified parameter. The value null
is returned if
the parameter in question is an SQL NULL
.SQLException
- if a database error occurs.boolean getBoolean(int parameterIndex) throws SQLException
BIT
parameter as a boolean.parameterIndex
- the parameter number index, where the first parameter has
index 1.boolean
representing the parameter value. false
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.boolean getBoolean(String parameterName) throws SQLException
BIT
parameter as a boolean
.parameterName
- the desired parameter's name.boolean
representation of the value of the parameter.
false
is returned if the SQL value is NULL
.SQLException
- if a database error occurs.byte getByte(int parameterIndex) throws SQLException
TINYINT
parameter as a byte
.parameterIndex
- the parameter number index, where the first parameter has
index 1.byte
representation of the value of the parameter.
0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.byte getByte(String parameterName) throws SQLException
TINYINT
parameter as a Java
byte
.parameterName
- the desired parameter's name.byte
representation of the value of the parameter.
0
is returned if the SQL value is NULL
.SQLException
- if a database error occurs.byte[] getBytes(int parameterIndex) throws SQLException
BINARY
or
VARBINARY
parameter.parameterIndex
- the parameter number index, where the first parameter has
index 1.null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.byte[] getBytes(String parameterName) throws SQLException
BINARY
or
VARBINARY
parameter.parameterName
- the name of the parameter.null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Clob getClob(int parameterIndex) throws SQLException
CLOB
parameter as a java.sql.Clob
.parameterIndex
- the parameter number index, where the first parameter has
index 1.java.sql.Clob
representing the value of the
parameter. null
is returned if the value is SQL
NULL
.SQLException
- if a database error occurs.Clob
Clob getClob(String parameterName) throws SQLException
CLOB
parameter as a java.sql.Clob
.parameterName
- the name of the parameter.java.sql.Clob
with the value of the parameter. null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Clob
Date getDate(int parameterIndex) throws SQLException
DATE
parameter as a java.sql.Date
.parameterIndex
- the parameter number index, where the first parameter has
index 1.java.sql.Date
representing the parameter's value.
null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Date
Date getDate(int parameterIndex, Calendar cal) throws SQLException
DATE
parameter as a java.sql.Date
, using the specified Calendar
to construct the date.
The JDBC driver uses the calendar to create the Date using a particular timezone and locale. The default behavior of the driver is to use the VM defaults. See "Be wary of the default locale".
parameterIndex
- the parameter number index, where the first parameter has
index 1.cal
- the Calendar
to use to construct the datejava.sql.Date
giving the parameter's value. null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Date
Date getDate(String parameterName) throws SQLException
DATE
parameter as a java.sql.Date
.parameterName
- the name of the desired parameter.java.sql.Date
giving the parameter's value. null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Date
Date getDate(String parameterName, Calendar cal) throws SQLException
DATE
parameter as a java.sql.Date
, using the specified Calendar
to construct the date.
The JDBC driver uses the calendar to create the date using a particular timezone and locale. The default behavior of the driver is to use the VM defaults. See "Be wary of the default locale".
parameterName
- the name of the desired parameter.cal
- used for creating the returned Date
.java.sql.Date
giving the parameter's value. null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Date
double getDouble(int parameterIndex) throws SQLException
DOUBLE
parameter as a
double
.parameterIndex
- the parameter number index, where the first parameter has
index 1.double
. 0.0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.double getDouble(String parameterName) throws SQLException
DOUBLE
parameter as a
double
.parameterName
- the name of the desired parameter.double
. 0.0
is returned if the value is SQL NULL
.SQLException
- if there is a problem accessing the database.float getFloat(int parameterIndex) throws SQLException
FLOAT
parameter as a float
.parameterIndex
- the parameter number index, where the first parameter has
index 1.float
. 0.0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.float getFloat(String parameterName) throws SQLException
FLOAT
parameter as a Java
float
.parameterName
- the name of the desired parameter.float
. 0.0
is returned if the value is SQL NULL
.SQLException
- if there is a problem accessing the database.int getInt(int parameterIndex) throws SQLException
INTEGER
parameter as an
int
.parameterIndex
- the parameter number index, where the first parameter has
index 1.int
giving the parameter's value. 0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.int getInt(String parameterName) throws SQLException
INTEGER
parameter as an
int
.parameterName
- the name of the desired parameter.int
giving the parameter's value. 0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.long getLong(int parameterIndex) throws SQLException
BIGINT
parameter as a
long
.parameterIndex
- the parameter number index, where the first parameter has
index 1.long
giving the parameter's value. 0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.long getLong(String parameterName) throws SQLException
BIGINT
parameter as a
long
.parameterName
- the name of the desired parameter.long
giving the parameter's value. 0
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Object getObject(int parameterIndex) throws SQLException
Object
.
The object type returned is the JDBC type registered for the parameter
with a registerOutParameter
call. If a parameter was registered
as a java.sql.Types.OTHER
then it may hold abstract types that
are particular to the connected database.
parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.Object getObject(int parameterIndex, Map<String,Class<?>> map) throws SQLException
Object
. The
Map
gives the correspondence between SQL types and Java classes.parameterIndex
- the parameter number index, where the first parameter has
index 1.map
- the Map
giving the correspondence between SQL
types and Java classes.SQLException
- if a database error occurs.Object getObject(String parameterName) throws SQLException
Object
.
The object type returned is the JDBC type that was registered for
the parameter by an earlier call to registerOutParameter(int, int)
.
If a parameter was registered as a java.sql.Types.OTHER
then it may hold abstract types that are particular to the
connected database.
parameterName
- the parameter name.Object
representation of the value of the
parameter.SQLException
- if there is a problem accessing the database.Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException
Object
. The
actual return type is determined by the Map
parameter which
gives the correspondence between SQL types and Java classes.parameterName
- the parameter name.map
- the Map
of SQL types to their Java counterpartsObject
holding the value of the parameter.SQLException
- if there is a problem accessing the database.Ref getRef(int parameterIndex) throws SQLException
REF(<structured type>)
parameter as a java.sql.Ref
.parameterIndex
- the parameter number index, where the first parameter has
index 1.java.sql.Ref
with the parameter value. null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Ref getRef(String parameterName) throws SQLException
REF(<structured type>)
parameter as a java.sql.Ref
.parameterName
- the desired parameter's name.java.sql.Ref
. A null
reference is returned if the
parameter's value is SQL NULL
.SQLException
- if there is a problem accessing the database.Ref
short getShort(int parameterIndex) throws SQLException
SMALLINT
parameter as a
short
.parameterIndex
- the parameter number index, where the first parameter has
index 1.short
. 0 is returned
if the parameter's value is SQL NULL
.SQLException
- if a database error occurs.short getShort(String parameterName) throws SQLException
SMALLINT
parameter as a
short
.parameterName
- the desired parameter's name.short
. 0 is returned
if the parameter's value is SQL NULL
.SQLException
- if there is a problem accessing the database.String getString(int parameterIndex) throws SQLException
String
. The
parameter value must be one of the JDBC types CHAR
,
VARCHAR
or LONGVARCHAR
.
The String
corresponding to a CHAR
of fixed length
will be of identical length to the value in the database inclusive
of padding characters.
parameterIndex
- the parameter number index, where the first parameter has
index 1.String
. null
is returned if the value is SQL NULL
.SQLException
- if there is a problem accessing the database.String getString(String parameterName) throws SQLException
CHAR
, VARCHAR
or LONGVARCHAR
.
The string corresponding to a CHAR
of fixed length will be of
identical length to the value in the database inclusive of padding
characters.
parameterName
- the desired parameter's name.String
. null
is returned if the value is SQL NULL
.SQLException
- if there is a problem accessing the database.Time getTime(int parameterIndex) throws SQLException
TIME
parameter as a java.sql.Time
.parameterIndex
- the parameter number index, where the first parameter has
index 1.java.sql.Time
.
null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Time
Time getTime(int parameterIndex, Calendar cal) throws SQLException
TIME
parameter as a java.sql.Time
, using the supplied Calendar
to construct the
time. The JDBC driver uses the calendar to handle specific timezones
and locales in order to determine Time
.parameterIndex
- the parameter number index, where the first parameter has
index 1.cal
- the calendar to use in constructing Time
.java.sql.Time
.
null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.Time
,
Calendar
Time getTime(String parameterName) throws SQLException
TIME
parameter as a java.sql.Time
.parameterName
- the name of the desired parameter.java.sql.Time
with the parameter's value. A null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.Time
Time getTime(String parameterName, Calendar cal) throws SQLException
TIME
parameter as a java.sql.Time
, using the supplied Calendar
to construct
the time. The JDBC driver uses the calendar to handle specific
timezones and locales when creating Time
.parameterName
- the name of the desired parameter.cal
- used for creating the returned Time
java.sql.Time
with the parameter's value. A null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.Time
,
Calendar
Timestamp getTimestamp(int parameterIndex) throws SQLException
TIMESTAMP
value as a java.sql.Timestamp
.parameterIndex
- the parameter number index, where the first parameter has
index 1java.sql.Timestamp
. A
null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.Timestamp
Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException
TIMESTAMP
value as a java.sql.Timestamp
. The JDBC driver uses the supplied Calendar
to handle specific timezones and locales when creating the result.parameterIndex
- the parameter number index, where the first parameter has
index 1cal
- used for creating the returned Timestamp
java.sql.Timestamp
. A
null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.Timestamp
Timestamp getTimestamp(String parameterName) throws SQLException
TIMESTAMP
value as a java.sql.Timestamp
.parameterName
- the name of the desired parameter.java.sql.Timestamp
. A
null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.Timestamp
Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException
TIMESTAMP
value as a java.sql.Timestamp
. The JDBC driver uses the supplied Calendar
to handle specific timezones and locales when creating the result.parameterName
- the name of the desired parameter.cal
- used for creating the returned Timestamp
java.sql.Timestamp
. A
null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.Timestamp
URL getURL(int parameterIndex) throws SQLException
DATALINK
parameter as a
java.net.URL
.parameterIndex
- the parameter number index, where the first parameter has
index 1.URL
giving the parameter's value. null
is returned if the value is SQL NULL
.SQLException
- if a database error occurs.URL
URL getURL(String parameterName) throws SQLException
DATALINK
value in a new Java
java.net.URL
.parameterName
- the name of the desired parameter.java.net.URL
encapsulating the parameter value. A
null
reference is returned for an SQL value of NULL
.SQLException
- if a database error occurs.URL
void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
OUT
parameter. All OUT
parameters must have their type defined before a stored procedure is
executed.
The type supplied in the sqlType
parameter fixes the
type that will be returned by the getter methods of
CallableStatement
.
If a database specific type is expected for a parameter, the Type java.sql.Types.OTHER
should be used. Note that there is another variant
of this method for User Defined Types or a REF
type.
parameterIndex
- the parameter number index, where the first parameter has
index 1sqlType
- the JDBC type as defined by java.sql.Types
. The JDBC
types NUMERIC
and DECIMAL
should be defined
using registerOutParameter(int, int, int)
.SQLException
- if a database error occurs.Types
void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
OUT
parameter. All OUT
parameters must have their type defined before a stored procedure is
executed. This version of the registerOutParameter
method, which
has a scale parameter, should be used for the JDBC types NUMERIC
and DECIMAL
, where there is a need to specify the number of
digits expected after the decimal point.
The type supplied in the sqlType
parameter fixes the
type that will be returned by the getter methods of
CallableStatement
.
parameterIndex
- the parameter number index, where the first parameter has
index 1sqlType
- the JDBC type as defined by java.sql.Types
.scale
- the number of digits after the decimal point. Must be greater
than or equal to 0.SQLException
- if a database error occurs.Types
void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException
OUT
parameter. This variant
of the method is designed for use with parameters that are
User Defined Types (UDT) or a REF
type, although it
can be used for any type.paramIndex
- the parameter number index, where the first parameter has
index 1.sqlType
- a JDBC type expressed as a constant from Types
.typeName
- an SQL type name. For a REF
type, this name should be
the fully qualified name of the referenced type.SQLException
- if a database error occurs.Ref
void registerOutParameter(String parameterName, int sqlType) throws SQLException
OUT
parameter. All OUT parameters
must have their Type defined before a stored procedure is executed.
The type supplied in the sqlType
parameter fixes the
type that will be returned by the getter methods of
CallableStatement
.
If a database-specific type is expected for a parameter, the Type java.sql.Types.OTHER
should be used. Note that there is another variant
of this method for User Defined Types or a REF
type.
parameterName
- the parameter name.sqlType
- a JDBC type expressed as a constant from Types
. Types
NUMERIC
and DECIMAL
should be defined using
the variant of this method that takes a scale
parameter.SQLException
- if a database error occurs.void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
OUT
parameter. All OUT
parameters must have their Type defined before a stored procedure is
executed. This version of the registerOutParameter
method, which
has a scale parameter, should be used for the JDBC types NUMERIC
and DECIMAL
, where there is a need to specify the number of
digits expected after the decimal point.
The type supplied in the sqlType
parameter fixes the
type that will be returned by the getter methods of
CallableStatement
.
parameterName
- the parameter name.sqlType
- a JDBC type expressed as a constant from Types
.scale
- the number of digits after the decimal point. Must be greater
than or equal to 0.SQLException
- if a database error occurs.void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException
OUT
parameter. This variant of
the method is designed for use with parameters that are User Defined
Types (UDT) or a REF
type, although it can be used for any
type.parameterName
- the parameter namesqlType
- a JDBC type expressed as a constant from Types
typeName
- the fully qualified name of an SQL structured type. For a
REF
type, this name should be the fully qualified name
of the referenced type.SQLException
- if a database error occurs.void setAsciiStream(String parameterName, InputStream theInputStream, int length) throws SQLException
InputStream
, which has a specified number of bytes.
This is a good method for setting an SQL LONGVARCHAR
parameter
where the length of the data is large. Data is read from the InputStream
until end-of-file is reached or the specified number of
bytes is copied.
parameterName
- the parameter nametheInputStream
- the ASCII input stream carrying the data to update the
parameter with.length
- the number of bytes in the InputStream
to copy to the
parameter.SQLException
- if a database error occurs.void setBigDecimal(String parameterName, BigDecimal theBigDecimal) throws SQLException
java.math.BigDecimal
value.parameterName
- the name of the parameter.theBigDecimal
- the java.math.BigInteger
value to set.SQLException
- if a database error occurs.void setBinaryStream(String parameterName, InputStream theInputStream, int length) throws SQLException
InputStream
, which has a specified number of bytes.
Use this method when a large amount of data needs to be set into a
LONGVARBINARY
parameter.
parameterName
- the name of the parameter.theInputStream
- the binary InputStream
carrying the data to update the
parameter.length
- the number of bytes in the InputStream
to copy to the
parameter.SQLException
- if a database error occurs.void setBoolean(String parameterName, boolean theBoolean) throws SQLException
boolean
value.parameterName
- the parameter name.theBoolean
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setByte(String parameterName, byte theByte) throws SQLException
byte
value.parameterName
- the parameter name.theByte
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setBytes(String parameterName, byte[] theBytes) throws SQLException
VARBINARY
or else LONGVARBINARY
in the
connected database.parameterName
- the parameter name.theBytes
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
Reader
object, with the specified length of character data.parameterName
- the parameter name.reader
- the new value with which to update the parameter.length
- a count of the characters contained in reader
.SQLException
- if a database error occurs.void setDate(String parameterName, Date theDate) throws SQLException
java.sql.Date
value.parameterName
- the parameter name.theDate
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setDate(String parameterName, Date theDate, Calendar cal) throws SQLException
java.sql.Date
value, using a supplied calendar to map the date. The
calendar allows the application to control the timezone used to compute
the SQL DATE
in the database. In case that no calendar is
supplied, the driver uses the default timezone of the Java virtual
machine.parameterName
- the parameter name.theDate
- the new value with which to update the parameter.cal
- a Calendar
to use to construct the SQL DATE
value.SQLException
- if a database error occurs.Calendar
,
Date
void setDouble(String parameterName, double theDouble) throws SQLException
double
value.parameterName
- the parameter name.theDouble
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setFloat(String parameterName, float theFloat) throws SQLException
float
value.parameterName
- the parameter name.theFloat
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setInt(String parameterName, int theInt) throws SQLException
int
value.parameterName
- the parameter name.theInt
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setLong(String parameterName, long theLong) throws SQLException
long
value.parameterName
- the parameter name.theLong
- the new value with which to update the parameter.SQLException
- if a database error occurs.void setNull(String parameterName, int sqlType) throws SQLException
NULL
. Don't use
this version of setNull
for User Defined Types (UDT) or
for REF
type parameters.parameterName
- the parameter name.sqlType
- a JDBC type expressed as a constant from Types
.SQLException
- if a database error occurs.void setNull(String parameterName, int sqlType, String typeName) throws SQLException
NULL
where the
parameter type is either REF
or user defined (e.g. STRUCT
, JAVA_OBJECT
etc).
For reasons of portability, the caller is expected to supply both the SQL
type code and type name (which is just the parameter name if the type is
user defined, referred to as a UDT
, or the name of the referenced
type in case of a REF
type).
parameterName
- the parameter name.sqlType
- a JDBC type expressed as a constant from Types
.typeName
- if the target parameter is a user defined type then this
should contain the full type name. The fully qualified name of
a UDT
or REF
type is ignored if the parameter
is not a UDT
.SQLException
- if a database error occurs.Types
void setObject(String parameterName, Object theObject) throws SQLException
theObject
is
transformed to the corresponding SQL type according to the standard Java
to SQL mapping rules.
If the object's class implements the interface SQLData
, the JDBC
driver calls SQLData.writeSQL
to write it to the SQL data stream.
If theObject
implements any of the following interfaces then the
driver is in charge of mapping the value to the appropriate SQL type.
parameterName
- the parameter nametheObject
- the new value with which to update the parameterSQLException
- if a database error occurs.SQLData
void setObject(String parameterName, Object theObject, int targetSqlType) throws SQLException
The parameter theObject
is converted to the given targetSqlType
before it is sent to the database. If the object has a
custom mapping (its class implements the interface SQLData
), the
JDBC driver calls the method SQLData.writeSQL
to write it to the
SQL data stream. If theObject
is an instance of one of the
following types
parameterName
- the parameter name.theObject
- the new value with which to update the parameter.targetSqlType
- a JDBC type expressed as a constant from Types
.SQLException
- if a database error occurs.SQLData
void setObject(String parameterName, Object theObject, int targetSqlType, int scale) throws SQLException
The object is converted to the given targetSqlType
before it is
sent to the database. If the object has a custom mapping (its class
implements the interface SQLData
), the JDBC driver calls the
method SQLData.writeSQL
to write it to the SQL data stream. If
theObject
implements any of the following interfaces
parameterName
- the parameter name.theObject
- the new value with which to update the parameter.targetSqlType
- a JDBC type expressed as a constant from Types
.scale
- where applicable, the number of digits after the decimal.
point.SQLException
- if a database error occurs.SQLData
void setShort(String parameterName, short theShort) throws SQLException
short
value.parameterName
- the name of the parameter.theShort
- a short value to update the parameter.SQLException
- if a database error occurs.void setString(String parameterName, String theString) throws SQLException
String
.parameterName
- the name of the parameter.theString
- a String
value to update the parameter.SQLException
- if a database error occurs.void setTime(String parameterName, Time theTime) throws SQLException
parameterName
to the value
of the supplied java.sql.Time
.parameterName
- the parameter name.theTime
- the new value with which to update the parameter.SQLException
- if a database error occurs.Time
void setTime(String parameterName, Time theTime, Calendar cal) throws SQLException
parameterName
to the value
of the supplied java.sql.Time
using the supplied calendar.
The driver uses the supplied Calendar
to create the SQL
TIME
value, which allows it to use a custom timezone -
otherwise the driver uses the VM defaults.
See "Be wary of the default locale".
parameterName
- the parameter name.theTime
- the new value with which to update the parameter.cal
- used for creating the new SQL TIME
value.SQLException
- if a database error occurs.Time
void setTimestamp(String parameterName, Timestamp theTimestamp) throws SQLException
java.sql.Timestamp
value.parameterName
- the parameter name.theTimestamp
- the new value with which to update the parameter.SQLException
- if a database error occurs.Timestamp
void setTimestamp(String parameterName, Timestamp theTimestamp, Calendar cal) throws SQLException
java.sql.Timestamp
value, using the supplied calendar.
The driver uses the supplied calendar to create the SQL TIMESTAMP
value, which allows it to use a custom timezone - otherwise the driver
uses the VM defaults.
See "Be wary of the default locale".
parameterName
- the parameter name.theTimestamp
- the new value with which to update the parameter.cal
- used for creating the new SQL TIME
value.SQLException
- if a database error occurs.Timestamp
,
Calendar
void setURL(String parameterName, URL theURL) throws SQLException
java.net.URL
.parameterName
- the parameter name.theURL
- the new value with which to update the parameter.SQLException
- if a database error occurs.URL
boolean wasNull() throws SQLException
OUT
parameter read was SQL
NULL
.NULL
, false
otherwise.SQLException
- if a database error occurs.RowId getRowId(int parameterIndex) throws SQLException
ROWID
parameter as a java.sql.RowId
.parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.RowId getRowId(String parameterName) throws SQLException
java.sql.RowId
.parameterName
- the parameter nameSQLException
- if a database error occursvoid setRowId(String parameterName, RowId rowId) throws SQLException
rowId
.SQLException
- if a database error occursvoid setNString(String parameterName, String string) throws SQLException
string
.SQLException
- if a database error occursvoid setNCharacterStream(String parameterName, Reader reader, long length) throws SQLException
reader
.SQLException
- if a database error occursvoid setNClob(String parameterName, NClob nclob) throws SQLException
nclob
.SQLException
- if a database error occursvoid setClob(String parameterName, Reader reader, long length) throws SQLException
length
characters from the given reader
.SQLException
- if a database error occursvoid setBlob(String parameterName, InputStream inputStream, long length) throws SQLException
length
bytes from the given inputStream
.SQLException
- if a database error occursvoid setNClob(String parameterName, Reader reader, long length) throws SQLException
length
characters from the given reader
.SQLException
- if a database error occursNClob getNClob(int parameterIndex) throws SQLException
java.sql.NClob
.parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.NClob getNClob(String parameterName) throws SQLException
java.sql.NClob
.parameterName
- the parameter nameSQLException
- if a database error occursvoid setSQLXML(String parameterName, SQLXML sqlXml) throws SQLException
sqlXml
.SQLException
- if a database error occursSQLXML getSQLXML(int parameterIndex) throws SQLException
java.sql.SQLXML
.parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.SQLXML getSQLXML(String parameterName) throws SQLException
java.sql.SQLXML
.parameterName
- the parameter nameSQLException
- if a database error occursString getNString(int parameterIndex) throws SQLException
java.lang.String
.parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.String getNString(String parameterName) throws SQLException
java.lang.String
.parameterName
- the parameter nameSQLException
- if a database error occursReader getNCharacterStream(int parameterIndex) throws SQLException
Reader
.parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.Reader getNCharacterStream(String parameterName) throws SQLException
java.io.Reader
.parameterName
- the parameter nameSQLException
- if a database error occursReader getCharacterStream(int parameterIndex) throws SQLException
java.io.Reader
.parameterIndex
- the parameter number index, where the first parameter has
index 1.SQLException
- if a database error occurs.Reader getCharacterStream(String parameterName) throws SQLException
java.io.Reader
.parameterName
- the parameter nameSQLException
- if a database error occursvoid setBlob(String parameterName, Blob blob) throws SQLException
blob
.SQLException
- if a database error occursvoid setClob(String parameterName, Clob clob) throws SQLException
clob
.SQLException
- if a database error occursvoid setAsciiStream(String parameterName, InputStream x, long length) throws SQLException
length
bytes from the given inputStream
.SQLException
- if a database error occursvoid setAsciiStream(String parameterName, InputStream x) throws SQLException
reader
.SQLException
- if a database error occursvoid setBinaryStream(String parameterName, InputStream x, long length) throws SQLException
length
bytes from the given inputStream
.SQLException
- if a database error occursvoid setBinaryStream(String parameterName, InputStream x) throws SQLException
reader
.SQLException
- if a database error occursvoid setCharacterStream(String parameterName, Reader reader, long length) throws SQLException
length
characters from the given reader
.SQLException
- if a database error occursvoid setCharacterStream(String parameterName, Reader reader) throws SQLException
reader
.SQLException
- if a database error occursvoid setNCharacterStream(String parameterName, Reader value) throws SQLException
reader
.SQLException
- if a database error occursvoid setClob(String parameterName, Reader reader) throws SQLException
reader
.SQLException
- if a database error occursvoid setBlob(String parameterName, InputStream inputStream) throws SQLException
inputStream
.SQLException
- if a database error occursvoid setNClob(String parameterName, Reader reader) throws SQLException
reader
.SQLException
- if a database error occurs