|
Oracle® Database JDBC Java API Reference 11g Release 2 ("11.2.0.0.1-Beta-1") BETA E13995-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OracleCallableStatement
This interface extends the OraclePreparedStatement
(which extends the OracleStatement
interface) and incorporates standard JDBC callable statement functionality. It is used to execute SQL stored procedure.
Oracle JDBC drivers support execution of PL/SQL stored procedures and anonymous blocks. They support both SQL92 escape syntax and Oracle PL/SQL block syntax. The following PL/SQL calls would work with any Oracle JDBC driver:
// SQL92 syntax CallableStatement cs1 = conn.prepareCall ( "{call proc (?,?)}" ) ; // stored proc CallableStatement cs2 = conn.prepareCall ( "{? = call func (?,?)}" ) ; // stored func // Oracle PL/SQL block syntax CallableStatement cs3 = conn.prepareCall ( "begin proc (?,?); end;" ) ; // stored proc CallableStatement cs4 = conn.prepareCall ( "begin ? := func(?,?); end;" ) ; // stored func
As an example of using Oracle syntax, here is a PL/SQL code snippet that creates a stored function. The PL/SQL function gets a character sequence and concatenates a suffix to it:
create or replace function foo (val1 char) return char as begin return val1 || 'suffix'; end;
Your invocation call in your JDBC program should look like:
Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@<hoststring>", "scott", "tiger"); CallableStatement cs = conn.prepareCall ("begin ? := foo(?); end;"); cs.registerOutParameter(1,Types.CHAR); cs.setString(2, "aa"); cs.executeUpdate(); String result = cs.getString(1);
Connection.prepareCall
Field Summary |
---|
Fields inherited from interface oracle.jdbc.OraclePreparedStatement |
---|
FORM_CHAR, FORM_NCHAR |
Fields inherited from interface oracle.jdbc.OracleStatement |
---|
EXPLICIT, IMPLICIT, NEW |
Fields inherited from interface java.sql.Statement |
---|
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
Method Summary | |
---|---|
java.lang.Object |
getAnyDataEmbeddedObject(int parameterIndex) Deprecated. As of Oracle 11R1 there is full support for ANYTYPE and ANYDATA. Please use oracle.sql.ANYDATA for new code and plan on replacing any use of this method by the next major release. Note that in 11R1 this method is reimplemnted using the ANYDATA support and will now also function in all the drivers, not just oci. In the previous implementation it was possible to call registerOutParameter with a sqlType of either oracle.jdbc.OracleTypes.OPAQUE or oracle.jdbc.OracleTypes.STRUCT The new implemention requires the correct type which is OPAQUE. |
ARRAY |
getARRAY(int parameterIndex) Retrieves data into an oracle.sql.ARRAY object. |
java.io.InputStream |
getAsciiStream(int parameterIndex) Retrieves data into an java.io.InputStream object. |
BFILE |
getBfile(int parameterIndex) Retrieves data into an oracle.sql.BFILE object. |
BFILE |
getBFILE(int parameterIndex) Retrieves data into an oracle.sql.BFILE object. |
java.io.InputStream |
getBinaryStream(int parameterIndex) Retrieves data into an java.io.InputStream object. |
java.io.InputStream |
getBinaryStream(java.lang.String parameterName) Retrieves data into an java.io.InputStream object. |
BLOB |
getBLOB(int parameterIndex) Retrieves data into an oracle.sql.BLOB object. |
CHAR |
getCHAR(int parameterIndex) Retrieves data into an oracle.sql.CHAR object. |
java.io.Reader |
getCharacterStream(int parameterIndex) Retrieves data into an java.io.Reader object. |
CLOB |
getCLOB(int parameterIndex) Retrieves data into an oracle.sql.CLOB object. |
java.sql.ResultSet |
getCursor(int parameterIndex) Retrieves data into an java.sql.ResultSet object. |
java.lang.Object |
getCustomDatum(int parameterIndex, CustomDatumFactory factory) Deprecated. |
DATE |
getDATE(int parameterIndex) Retrieves data into an oracle.sql.DATE object. |
INTERVALDS |
getINTERVALDS(int parameterIndex) Retrieves data into an oracle.sql.INTERVALDS object. |
INTERVALYM |
getINTERVALYM(int parameterIndex) Retrieves data into an oracle.sql.INTERVALYM object. |
NUMBER |
getNUMBER(int parameterIndex) Retrieves data into an oracle.sql.NUMBER object. |
OPAQUE |
getOPAQUE(int parameterIndex) Retrieves data into an oracle.sql.OPAQUE object. |
Datum |
getOracleObject(int parameterIndex) Retrieves data into an oracle.sql.Datum object. |
Datum[] |
getOraclePlsqlIndexTable(int paramIndex) Oracle OCI driver specific. |
java.lang.Object |
getORAData(int parameterIndex, ORADataFactory factory) |
java.lang.Object |
getPlsqlIndexTable(int paramIndex) Get the value of a PLSQL index table parameter as a Java array. |
java.lang.Object |
getPlsqlIndexTable(int paramIndex, java.lang.Class primitiveType) Oracle OCI driver specific. |
RAW |
getRAW(int parameterIndex) Retrieves data into an oracle.sql.RAW object. |
REF |
getREF(int parameterIndex) Retrieves data into an oracle.sql.REF object. |
ROWID |
getROWID(int parameterIndex) Retrieves data into an oracle.sql.ROWID object. |
STRUCT |
getSTRUCT(int parameterIndex) Retrieves data into an oracle.sql.STRUCT object. |
TIMESTAMP |
getTIMESTAMP(int paramIdx) Retrieves data into an oracle.sql.TIMESTAMP object. |
TIMESTAMPLTZ |
getTIMESTAMPLTZ(int paramIdx) Retrieves data into an oracle.sql.TIMESTAMPLTZ object. |
TIMESTAMPTZ |
getTIMESTAMPTZ(int paramIdx) Retrieves data into an oracle.sql.TIMESTAMPTZ object. |
java.io.InputStream |
getUnicodeStream(int parameterIndex) Retrieves data into an java.io.InputStream object. |
java.io.InputStream |
getUnicodeStream(java.lang.String parameterName) Retrieves data into an java.io.InputStream object. |
void |
registerIndexTableOutParameter(int paramIndex, int maxLen, int elemSqlType, int elemMaxLen) Oracle OCI driver specific. |
void |
registerOutParameter(int paramIndex, int sqlType, int scale, int maxLength) Special Oracle version of registerOutParameter for registering CHAR, VARCHAR, LONG, RAW and LONG RAW columns. |
void |
registerOutParameter(java.lang.String parameterName, int sqlType, int scale, int maxLength) Special Oracle version of registerOutParameter for registering CHAR, VARCHAR, LONG, RAW and LONG RAW columns. |
void |
registerOutParameterBytes(int paramIndex, int sqlType, int scale, int maxLength) Deprecated. As of Oracle 10g Release 1 all character values are measured in Java chars so this method is no longer supported. It now is the equivalent of calling registerOutParameter with the same args. Since the number of bytes is at least as large as the number of characters this will always work although it may waste memory. Use registerOutParameter with the number of Java chars instead. |
void |
registerOutParameterChars(int paramIndex, int sqlType, int scale, int maxLength) Deprecated. As of Oracle 10g Release 1 all character values are measured in Java chars so this method is no longer needed. Call registerOutParameter with the same args instead. |
int |
sendBatch() Send the sets of parameters batched (for Oracle-style batching only). |
void |
setArray(java.lang.String parameterName, java.sql.Array x) |
void |
setARRAY(java.lang.String parameterName, ARRAY x) |
void |
setAsciiStream(java.lang.String parameterName, java.io.InputStream x, int y) Sets the designated parameter to the given input stream, which will have the specified number of bytes. |
void |
setBfile(java.lang.String parameterName, BFILE x) |
void |
setBFILE(java.lang.String parameterName, BFILE x) |
void |
setBigDecimal(java.lang.String parameterName, java.math.BigDecimal x) Sets the designated parameter to the given java.math.BigDecimal value. |
void |
setBinaryDouble(java.lang.String parameterName, BINARY_DOUBLE x) Sets the designated parameter to the given oracle.sql.BINARY_FLOAT value. |
void |
setBinaryDouble(java.lang.String parameterName, double x) Sets the designated parameter to the given oracle.sql.BINARY_FLOAT value. |
void |
setBinaryFloat(java.lang.String parameterName, BINARY_FLOAT x) Sets the designated parameter to the given oracle.sql.BINARY_FLOAT value. |
void |
setBinaryFloat(java.lang.String parameterName, float x) Sets the designated parameter to the given Java float value. |
void |
setBinaryStream(java.lang.String parameterName, java.io.InputStream x, int y) Sets the designated parameter to the given input stream, which will have the specified number of bytes. |
void |
setBlob(java.lang.String parameterName, java.sql.Blob x) |
void |
setBLOB(java.lang.String parameterName, BLOB x) |
void |
setBoolean(java.lang.String parameterName, boolean x) Sets the designated parameter to the given Java boolean value. |
void |
setByte(java.lang.String parameterName, byte x) Sets the designated parameter to the given Java byte value. |
void |
setBytes(java.lang.String parameterName, byte[] x) Sets the designated parameter to the given Java array of bytes. |
void |
setBytesForBlob(java.lang.String parameterName, byte[] x) Sets the designated parameter to the given Java byte[] value. |
void |
setCHAR(java.lang.String parameterName, CHAR x) |
void |
setCharacterStream(java.lang.String parameterName, java.io.Reader x, int y) Sets the designated parameter to the given Reader object, which is the given number of characters long. |
void |
setClob(java.lang.String parameterName, java.sql.Clob x) |
void |
setCLOB(java.lang.String parameterName, CLOB x) |
void |
setCursor(java.lang.String parameterName, java.sql.ResultSet x) |
void |
setCustomDatum(java.lang.String parameterName, CustomDatum x) |
void |
setDate(java.lang.String parameterName, java.sql.Date x) Sets the designated parameter to the given java.sql.Date value. |
void |
setDATE(java.lang.String parameterName, DATE x) |
void |
setDate(java.lang.String parameterName, java.sql.Date x, java.util.Calendar cal) Sets the designated parameter to the given java.sql.Date value, using the given Calendar object. |
void |
setDouble(java.lang.String parameterName, double x) Sets the designated parameter to the given Java double value. |
void |
setExecuteBatch(int nrows) Set the batch value (for Oracle-style batching only). |
void |
setFixedCHAR(java.lang.String parameterName, java.lang.String x) |
void |
setFloat(java.lang.String parameterName, float x) Sets the designated parameter to the given Java float value. |
void |
setInt(java.lang.String parameterName, int x) Sets the designated parameter to the given Java int value. |
void |
setINTERVALDS(java.lang.String parameterName, INTERVALDS x) |
void |
setINTERVALYM(java.lang.String parameterName, INTERVALYM x) |
void |
setLong(java.lang.String parameterName, long x) Sets the designated parameter to the given Java long value. |
void |
setNull(java.lang.String parameterName, int sqlType) Sets the designated parameter to SQL NULL . |
void |
setNull(java.lang.String parameterName, int sqlType, java.lang.String typeName) Sets the designated parameter to SQL NULL . |
void |
setNUMBER(java.lang.String parameterName, NUMBER x) |
void |
setObject(java.lang.String parameterName, java.lang.Object x) Sets the value of the designated parameter with the given object. |
void |
setObject(java.lang.String parameterName, java.lang.Object x, int y) Sets the value of the designated parameter with the given object. |
void |
setObject(java.lang.String parameterName, java.lang.Object x, int targetSqlType, int scale) Sets the value of the designated parameter with the given object. |
void |
setOPAQUE(java.lang.String parameterName, OPAQUE x) |
void |
setOracleObject(java.lang.String parameterName, Datum x) |
void |
setORAData(java.lang.String parameterName, ORAData x) |
void |
setRAW(java.lang.String parameterName, RAW x) |
void |
setRef(java.lang.String parameterName, java.sql.Ref x) |
void |
setREF(java.lang.String parameterName, REF x) |
void |
setRefType(java.lang.String parameterName, REF x) |
void |
setROWID(java.lang.String parameterName, ROWID x) |
void |
setShort(java.lang.String parameterName, short x) Sets the designated parameter to the given Java short value. |
void |
setString(java.lang.String parameterName, java.lang.String x) Sets the designated parameter to the given Java String value. |
void |
setStringForClob(java.lang.String parameterName, java.lang.String x) Sets the designated parameter to the given Java String value. |
void |
setSTRUCT(java.lang.String parameterName, STRUCT x) |
void |
setStructDescriptor(java.lang.String parameterName, StructDescriptor x) |
void |
setTime(java.lang.String parameterName, java.sql.Time x) Sets the designated parameter to the given java.sql.Time value. |
void |
setTime(java.lang.String parameterName, java.sql.Time x, java.util.Calendar cal) Sets the designated parameter to the given java.sql.Time value, using the given Calendar object. |
void |
setTimestamp(java.lang.String parameterName, java.sql.Timestamp x) Sets the designated parameter to the given java.sql.Timestamp value. |
void |
setTIMESTAMP(java.lang.String parameterName, TIMESTAMP x) |
void |
setTimestamp(java.lang.String parameterName, java.sql.Timestamp x, java.util.Calendar cal) Sets the designated parameter to the given java.sql.Timestamp value, using the given Calendar object. |
void |
setTIMESTAMPLTZ(java.lang.String parameterName, TIMESTAMPLTZ x) |
void |
setTIMESTAMPTZ(java.lang.String parameterName, TIMESTAMPTZ x) |
void |
setUnicodeStream(java.lang.String parameterName, java.io.InputStream x, int y) |
void |
setURL(java.lang.String parameterName, java.net.URL x) Sets the designated parameter to the given java.net.URL object. |
Methods inherited from interface java.sql.CallableStatement |
---|
getArray, getArray, getBigDecimal, getBigDecimal, getBigDecimal, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getClob, getClob, getDate, getDate, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getRef, getRef, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getURL, getURL, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, setAsciiStream, setAsciiStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setCharacterStream, setCharacterStream, setClob, setClob, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setRowId, setSQLXML, wasNull |
Methods inherited from interface java.sql.PreparedStatement |
---|
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 |
Methods inherited from interface oracle.jdbc.OracleStatement |
---|
clearDefines, closeWithKey, creationState, defineColumnType, defineColumnType, defineColumnType, defineColumnType, defineColumnTypeBytes, defineColumnTypeChars, getLobPrefetchSize, getRegisteredQueryId, getRegisteredTableNames, getRowPrefetch, isNCHAR, setDatabaseChangeRegistration, setLobPrefetchSize, setResultSetCache, setRowPrefetch |
Methods inherited from interface java.sql.Statement |
---|
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 |
Methods inherited from interface java.sql.Wrapper |
---|
isWrapperFor, unwrap |
Method Detail |
---|
ARRAY getARRAY(int parameterIndex) throws java.sql.SQLException
oracle.sql.ARRAY
object.parameterIndex
- the first parameter is 1, the second is 2, and so onARRAY
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.io.InputStream getAsciiStream(int parameterIndex) throws java.sql.SQLException
java.io.InputStream
object.parameterIndex
- the first parameter is 1, the second is 2, and so onjava.io.InputStream
java.sql.SQLException
- if an error occurs (conversion or database-access error)BFILE getBFILE(int parameterIndex) throws java.sql.SQLException
oracle.sql.BFILE
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.BFILE
java.sql.SQLException
- if an error occurs (conversion or database-access error)BFILE getBfile(int parameterIndex) throws java.sql.SQLException
oracle.sql.BFILE
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.BFILE
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.io.InputStream getBinaryStream(int parameterIndex) throws java.sql.SQLException
java.io.InputStream
object.parameterIndex
- the first parameter is 1, the second is 2, and so onjava.io.InputStream
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.io.InputStream getBinaryStream(java.lang.String parameterName) throws java.sql.SQLException
java.io.InputStream
object.parameterName
- the name of the stored procedure formal parameterjava.io.InputStream
java.sql.SQLException
- if an error occurs (conversion or database-access error)BLOB getBLOB(int parameterIndex) throws java.sql.SQLException
oracle.sql.BLOB
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.BLOB
java.sql.SQLException
- if an error occurs (conversion or database-access error)CHAR getCHAR(int parameterIndex) throws java.sql.SQLException
oracle.sql.CHAR
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.CHAR
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.io.Reader getCharacterStream(int parameterIndex) throws java.sql.SQLException
java.io.Reader
object.getCharacterStream
in interface java.sql.CallableStatement
parameterIndex
- the first parameter is 1, the second is 2, and so onjava.io.Reader
java.sql.SQLException
- if an error occurs (conversion or database-access error)CLOB getCLOB(int parameterIndex) throws java.sql.SQLException
oracle.sql.CLOB
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.CLOB
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.sql.ResultSet getCursor(int parameterIndex) throws java.sql.SQLException
java.sql.ResultSet
object.parameterIndex
- the first parameter is 1, the second is 2, and so onjava.sql.ResultSet
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.lang.Object getCustomDatum(int parameterIndex, CustomDatumFactory factory) throws java.sql.SQLException
parameterIndex
- the first parameter is 1, the second is 2, and so onfactory
-java.sql.SQLException
- if an error occurs (conversion or database-access error)java.lang.Object getORAData(int parameterIndex, ORADataFactory factory) throws java.sql.SQLException
parameterIndex
- the first parameter is 1, the second is 2, and so onfactory
-java.sql.SQLException
- if an error occurs (conversion or database-access error)java.lang.Object getAnyDataEmbeddedObject(int parameterIndex) throws java.sql.SQLException
parameterIndex
- the first parameter is 1java.sql.SQLException
- if an error occurs (conversion or database-access error)DATE getDATE(int parameterIndex) throws java.sql.SQLException
oracle.sql.DATE
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.DATE
java.sql.SQLException
- if an error occurs (conversion or database-access error)NUMBER getNUMBER(int parameterIndex) throws java.sql.SQLException
oracle.sql.NUMBER
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.NUMBER
java.sql.SQLException
- if an error occurs (conversion or database-access error)OPAQUE getOPAQUE(int parameterIndex) throws java.sql.SQLException
oracle.sql.OPAQUE
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.OPAQUE
java.sql.SQLException
- if an error occurs (conversion or database-access error)Datum getOracleObject(int parameterIndex) throws java.sql.SQLException
oracle.sql.Datum
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.Datum
java.sql.SQLException
- if an error occurs (conversion or database-access error)RAW getRAW(int parameterIndex) throws java.sql.SQLException
oracle.sql.RAW
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.RAW
java.sql.SQLException
- if an error occurs (conversion or database-access error)REF getREF(int parameterIndex) throws java.sql.SQLException
oracle.sql.REF
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.REF
java.sql.SQLException
- if an error occurs (conversion or database-access error)ROWID getROWID(int parameterIndex) throws java.sql.SQLException
oracle.sql.ROWID
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.ROWID
java.sql.SQLException
- if an error occurs (conversion or database-access error)STRUCT getSTRUCT(int parameterIndex) throws java.sql.SQLException
oracle.sql.STRUCT
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.STRUCT
java.sql.SQLException
- if an error occurs (conversion or database-access error)INTERVALYM getINTERVALYM(int parameterIndex) throws java.sql.SQLException
oracle.sql.INTERVALYM
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.INTERVALYM
java.sql.SQLException
- if an error occurs (conversion or database-access error)INTERVALDS getINTERVALDS(int parameterIndex) throws java.sql.SQLException
oracle.sql.INTERVALDS
object.parameterIndex
- the first parameter is 1, the second is 2, and so onoracle.sql.INTERVALDS
java.sql.SQLException
- if an error occurs (conversion or database-access error)TIMESTAMP getTIMESTAMP(int paramIdx) throws java.sql.SQLException
oracle.sql.TIMESTAMP
object.paramIdx
- the first parameter is 1, the second is 2, and so onoracle.sql.TIMESTAMP
java.sql.SQLException
- if an error occurs (conversion or database-access error)TIMESTAMPTZ getTIMESTAMPTZ(int paramIdx) throws java.sql.SQLException
oracle.sql.TIMESTAMPTZ
object.paramIdx
- the first parameter is 1, the second is 2, and so onoracle.sql.TIMESTAMPTZ
java.sql.SQLException
- if an error occurs (conversion or database-access error)TIMESTAMPLTZ getTIMESTAMPLTZ(int paramIdx) throws java.sql.SQLException
oracle.sql.TIMESTAMPLTZ
object.paramIdx
- the first parameter is 1, the second is 2, and so onoracle.sql.TIMESTAMPLTZ
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.io.InputStream getUnicodeStream(int parameterIndex) throws java.sql.SQLException
java.io.InputStream
object.parameterIndex
- the first parameter is 1, the second is 2, and so onjava.io.InputStream
java.sql.SQLException
- if an error occurs (conversion or database-access error)java.io.InputStream getUnicodeStream(java.lang.String parameterName) throws java.sql.SQLException
java.io.InputStream
object.parameterName
- the name of the stored procedure formal parameterjava.io.InputStream
java.sql.SQLException
- if an error occurs (conversion or database-access error)void registerOutParameter(int paramIndex, int sqlType, int scale, int maxLength) throws java.sql.SQLException
paramIndex
- parameter index (the first parameter is 1).sqlType
- type of the bind parameterscale
- not usedmaxLength
- maximum length of the column, specified in bytes or characters.java.sql.SQLException
- if an error occurs (conversion or database-access error)void registerOutParameterBytes(int paramIndex, int sqlType, int scale, int maxLength) throws java.sql.SQLException
paramIndex
- parameter index (the first parameter is 1).sqlType
- type of the bind parameterscale
- not usedmaxLength
- maximum length of the column, specified in bytes. If not specified, maximum length allowed for that type is used.java.sql.SQLException
- if an error occurs (conversion or database-access error)void registerOutParameterChars(int paramIndex, int sqlType, int scale, int maxLength) throws java.sql.SQLException
paramIndex
- parameter index (the first parameter is 1).sqlType
- type of the bind parameterscale
- not usedmaxLength
- maximum length of the column, specified in characters. If not specified, maximum length allowed for that type is used.java.sql.SQLException
- if an error occurs (conversion or database-access error)int sendBatch() throws java.sql.SQLException
Oracle-style batching is not supported for a callable statement. This method simply returns the number of valid rows.
sendBatch
in interface OraclePreparedStatement
java.sql.SQLException
- if an error occurs (conversion or database-access error)void setExecuteBatch(int nrows) throws java.sql.SQLException
Oracle-style batching is not supported for a callable statement. This method always sets the batch value to 1.
setExecuteBatch
in interface OraclePreparedStatement
nrows
- batch value to be set. It must be greater than or equal to 1.java.sql.SQLException
- if an error occurs (conversion or database-access error)getExecuteBatch
, OracleConnection.setDefaultExecuteBatch
java.lang.Object getPlsqlIndexTable(int paramIndex) throws java.sql.SQLException
paramIndex
- the first parameter is 1, the second is 2, and so onjava.sql.SQLException
- if a database-access error occurs.java.sql.SQLException
- if an error occurs (conversion or database-access error)java.lang.Object getPlsqlIndexTable(int paramIndex, java.lang.Class primitiveType) throws java.sql.SQLException
paramIndex
- the first parameter is 1, the second is 2, and so onprimitiveType
- is a primitive type class. For example,java.lang.Double.Typejava.sql.SQLException
- if a database-access error occurs.java.sql.SQLException
- if an error occurs (conversion or database-access error)Datum[] getOraclePlsqlIndexTable(int paramIndex) throws java.sql.SQLException
paramIndex
- the first parameter is 1, the second is 2, and so onjava.sql.SQLException
- if a database-access error occurs.java.sql.SQLException
- if an error occurs (conversion or database-access error)void registerIndexTableOutParameter(int paramIndex, int maxLen, int elemSqlType, int elemMaxLen) throws java.sql.SQLException
paramIndex
- the first parameter is 1, the second is 2, and so onmaxLen
- the maximum possible number of elements.curLen
- the current number of elementselemSqlType
- index table element SQL type (as defined in java.sql.Types or OracleTypes).elemMaxLen
- maximum length of the element. If not specified, maximum length allowed for that type is used.java.sql.SQLException
- if sqlType is invalid, or an error occurred.void setBinaryFloat(java.lang.String parameterName, BINARY_FLOAT x) throws java.sql.SQLException
oracle.sql.BINARY_FLOAT
value.parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getFloat(int)
void setBinaryDouble(java.lang.String parameterName, BINARY_DOUBLE x) throws java.sql.SQLException
oracle.sql.BINARY_FLOAT
value.parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getDouble(int)
void setStringForClob(java.lang.String parameterName, java.lang.String x) throws java.sql.SQLException
String
value. The driver converts this to an SQL VARCHAR
or LONGVARCHAR
value (depending on the argument's size relative to the driver's limits on VARCHAR
values) when it sends it to the database. If the string is larger than 32765 it is converted to a temporary clob and that is sent to the database. This clob conversion produces data truncation for columns of type VARCHAR
and LONGVARCHAR
. This is wrong.parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getString(int)
void setBytesForBlob(java.lang.String parameterName, byte[] x) throws java.sql.SQLException
byte[]
value. The driver converts this to an SQL BINARY
or LONGBINARY CHECK THIS
value (depending on the argument's size relative to the driver's limits on VARCHAR
values) when it sends it to the database. If the byte array is larger than 32765 it is converted to a temporary blob and that is sent to the database. This blob conversion produces data truncation for columns of type BINARY
..parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getString(int)
void registerOutParameter(java.lang.String parameterName, int sqlType, int scale, int maxLength) throws java.sql.SQLException
parameterName
- the name of the parametersqlType
- SQL type code defined by java.sql.Types
.scale
- the desired number of digits to the right of the decimal point. It must be greater than or equal to zero.maxLength
- maximum length of the column, specified in bytes or characters.java.sql.SQLException
- if an error occurs (conversion or database-access error)void setNull(java.lang.String parameterName, int sqlType, java.lang.String typeName) throws java.sql.SQLException
NULL
. This version of the method setNull
should be used for user-defined types and REF type parameters. Examples of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and named array types.
Note: To be portable, applications must give the SQL type code and the fully-qualified SQL type name when specifying a NULL user-defined or REF parameter. In the case of a user-defined type the name is the type name of the parameter itself. For a REF parameter, the name is the type name of the referenced type. If a JDBC driver does not need the type code or type name information, it may ignore it. Although it is intended for user-defined and Ref parameters, this method may be used to set a null parameter of any JDBC type. If the parameter does not have a user-defined or REF type, the given typeName is ignored.
setNull
in interface java.sql.CallableStatement
parameterName
- the name of the parametersqlType
- a value from java.sql.Types
typeName
- the fully-qualified name of an SQL user-defined type; ignored if the parameter is not a user-defined type or SQL REF
valuejava.sql.SQLException
- if a database access error occursvoid setNull(java.lang.String parameterName, int sqlType) throws java.sql.SQLException
NULL
.
Note: You must specify the parameter's SQL type.
setNull
in interface java.sql.CallableStatement
parameterName
- the name of the parametersqlType
- the SQL type code defined in java.sql.Types
java.sql.SQLException
- if a database access error occursvoid setBoolean(java.lang.String parameterName, boolean x) throws java.sql.SQLException
boolean
value. The driver converts this to an SQL BIT
value when it sends it to the database.setBoolean
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getBoolean(int)
void setByte(java.lang.String parameterName, byte x) throws java.sql.SQLException
byte
value. The driver converts this to an SQL TINYINT
value when it sends it to the database.setByte
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getByte(int)
void setShort(java.lang.String parameterName, short x) throws java.sql.SQLException
short
value. The driver converts this to an SQL SMALLINT
value when it sends it to the database.setShort
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getShort(int)
void setInt(java.lang.String parameterName, int x) throws java.sql.SQLException
int
value. The driver converts this to an SQL INTEGER
value when it sends it to the database.setInt
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getInt(int)
void setLong(java.lang.String parameterName, long x) throws java.sql.SQLException
long
value. The driver converts this to an SQL BIGINT
value when it sends it to the database.setLong
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getLong(int)
void setFloat(java.lang.String parameterName, float x) throws java.sql.SQLException
float
value. The driver converts this to an SQL FLOAT
value when it sends it to the database.setFloat
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getFloat(int)
void setBinaryFloat(java.lang.String parameterName, float x) throws java.sql.SQLException
float
value. The driver converts this to an SQL BINARY_FLOAT
value when it sends it to the database.parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getFloat(int)
void setBinaryDouble(java.lang.String parameterName, double x) throws java.sql.SQLException
oracle.sql.BINARY_FLOAT
value.parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getFloat(int)
void setDouble(java.lang.String parameterName, double x) throws java.sql.SQLException
double
value. The driver converts this to an SQL DOUBLE
value when it sends it to the database.setDouble
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getDouble(int)
void setBigDecimal(java.lang.String parameterName, java.math.BigDecimal x) throws java.sql.SQLException
java.math.BigDecimal
value. The driver converts this to an SQL NUMERIC
value when it sends it to the database.setBigDecimal
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getBigDecimal(int, int)
void setString(java.lang.String parameterName, java.lang.String x) throws java.sql.SQLException
String
value. The driver converts this to an SQL VARCHAR
or LONGVARCHAR
value (depending on the argument's size relative to the driver's limits on VARCHAR
values) when it sends it to the database.setString
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getString(int)
void setFixedCHAR(java.lang.String parameterName, java.lang.String x) throws java.sql.SQLException
java.sql.SQLException
void setCursor(java.lang.String parameterName, java.sql.ResultSet x) throws java.sql.SQLException
java.sql.SQLException
void setROWID(java.lang.String parameterName, ROWID x) throws java.sql.SQLException
java.sql.SQLException
void setRAW(java.lang.String parameterName, RAW x) throws java.sql.SQLException
java.sql.SQLException
void setCHAR(java.lang.String parameterName, CHAR x) throws java.sql.SQLException
java.sql.SQLException
void setDATE(java.lang.String parameterName, DATE x) throws java.sql.SQLException
java.sql.SQLException
void setNUMBER(java.lang.String parameterName, NUMBER x) throws java.sql.SQLException
java.sql.SQLException
void setBLOB(java.lang.String parameterName, BLOB x) throws java.sql.SQLException
java.sql.SQLException
void setBlob(java.lang.String parameterName, java.sql.Blob x) throws java.sql.SQLException
setBlob
in interface java.sql.CallableStatement
java.sql.SQLException
void setCLOB(java.lang.String parameterName, CLOB x) throws java.sql.SQLException
java.sql.SQLException
void setClob(java.lang.String parameterName, java.sql.Clob x) throws java.sql.SQLException
setClob
in interface java.sql.CallableStatement
java.sql.SQLException
void setBFILE(java.lang.String parameterName, BFILE x) throws java.sql.SQLException
java.sql.SQLException
void setBfile(java.lang.String parameterName, BFILE x) throws java.sql.SQLException
java.sql.SQLException
void setBytes(java.lang.String parameterName, byte[] x) throws java.sql.SQLException
VARBINARY
or LONGVARBINARY
(depending on the argument's size relative to the driver's limits on VARBINARY
values) when it sends it to the database.setBytes
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getBytes(int)
void setDate(java.lang.String parameterName, java.sql.Date x) throws java.sql.SQLException
java.sql.Date
value. The driver converts this to an SQL DATE
value when it sends it to the database.setDate
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getDate(int)
void setTime(java.lang.String parameterName, java.sql.Time x) throws java.sql.SQLException
java.sql.Time
value. The driver converts this to an SQL TIME
value when it sends it to the database.setTime
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getTime(int)
void setTimestamp(java.lang.String parameterName, java.sql.Timestamp x) throws java.sql.SQLException
java.sql.Timestamp
value. The driver converts this to an SQL TIMESTAMP
value when it sends it to the database.setTimestamp
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuejava.sql.SQLException
- if a database access error occursCallableStatement.getTimestamp(int)
void setINTERVALYM(java.lang.String parameterName, INTERVALYM x) throws java.sql.SQLException
java.sql.SQLException
void setINTERVALDS(java.lang.String parameterName, INTERVALDS x) throws java.sql.SQLException
java.sql.SQLException
void setTIMESTAMP(java.lang.String parameterName, TIMESTAMP x) throws java.sql.SQLException
java.sql.SQLException
void setTIMESTAMPTZ(java.lang.String parameterName, TIMESTAMPTZ x) throws java.sql.SQLException
java.sql.SQLException
void setTIMESTAMPLTZ(java.lang.String parameterName, TIMESTAMPLTZ x) throws java.sql.SQLException
java.sql.SQLException
void setAsciiStream(java.lang.String parameterName, java.io.InputStream x, int y) throws java.sql.SQLException
LONGVARCHAR
parameter, it may be more practical to send it via a java.io.InputStream
. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
setAsciiStream
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the Java input stream that contains the ASCII parameter valuelength
- the number of bytes in the streamjava.sql.SQLException
- if a database access error occursvoid setBinaryStream(java.lang.String parameterName, java.io.InputStream x, int y) throws java.sql.SQLException
LONGVARBINARY
parameter, it may be more practical to send it via a java.io.InputStream
object. The data will be read from the stream as needed until end-of-file is reached.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
setBinaryStream
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the java input stream which contains the binary parameter valuelength
- the number of bytes in the streamjava.sql.SQLException
- if a database access error occursvoid setUnicodeStream(java.lang.String parameterName, java.io.InputStream x, int y) throws java.sql.SQLException
java.sql.SQLException
void setCharacterStream(java.lang.String parameterName, java.io.Reader x, int y) throws java.sql.SQLException
Reader
object, which is the given number of characters long. When a very large UNICODE value is input to a LONGVARCHAR
parameter, it may be more practical to send it via a java.io.Reader
object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format.
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
setCharacterStream
in interface java.sql.CallableStatement
parameterName
- the name of the parameterreader
- the java.io.Reader
object that contains the UNICODE data used as the designated parameterlength
- the number of characters in the streamjava.sql.SQLException
- if a database access error occursvoid setDate(java.lang.String parameterName, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLException
java.sql.Date
value, using the given Calendar
object. The driver uses the Calendar
object to construct an SQL DATE
value, which the driver then sends to the database. With a a Calendar
object, the driver can calculate the date taking into account a custom time zone. If no Calendar
object is specified, the driver uses the default time zone, which is that of the virtual machine running the application.setDate
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuecal
- the Calendar
object the driver will use to construct the datejava.sql.SQLException
- if a database access error occursCallableStatement.getDate(int)
void setTime(java.lang.String parameterName, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLException
java.sql.Time
value, using the given Calendar
object. The driver uses the Calendar
object to construct an SQL TIME
value, which the driver then sends to the database. With a a Calendar
object, the driver can calculate the time taking into account a custom time zone. If no Calendar
object is specified, the driver uses the default time zone, which is that of the virtual machine running the application.setTime
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuecal
- the Calendar
object the driver will use to construct the timejava.sql.SQLException
- if a database access error occursCallableStatement.getTime(int)
void setTimestamp(java.lang.String parameterName, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLException
java.sql.Timestamp
value, using the given Calendar
object. The driver uses the Calendar
object to construct an SQL TIMESTAMP
value, which the driver then sends to the database. With a a Calendar
object, the driver can calculate the timestamp taking into account a custom time zone. If no Calendar
object is specified, the driver uses the default time zone, which is that of the virtual machine running the application.setTimestamp
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the parameter valuecal
- the Calendar
object the driver will use to construct the timestampjava.sql.SQLException
- if a database access error occursCallableStatement.getTimestamp(int)
void setURL(java.lang.String parameterName, java.net.URL x) throws java.sql.SQLException
java.net.URL
object. The driver converts this to an SQL DATALINK
value when it sends it to the database.setURL
in interface java.sql.CallableStatement
parameterName
- the name of the parameterval
- the parameter valuejava.sql.SQLException
- if a database access error occurs, or if a URL is malformedCallableStatement.getURL(int)
void setArray(java.lang.String parameterName, java.sql.Array x) throws java.sql.SQLException
java.sql.SQLException
void setARRAY(java.lang.String parameterName, ARRAY x) throws java.sql.SQLException
java.sql.SQLException
void setOPAQUE(java.lang.String parameterName, OPAQUE x) throws java.sql.SQLException
java.sql.SQLException
void setStructDescriptor(java.lang.String parameterName, StructDescriptor x) throws java.sql.SQLException
java.sql.SQLException
void setSTRUCT(java.lang.String parameterName, STRUCT x) throws java.sql.SQLException
java.sql.SQLException
void setCustomDatum(java.lang.String parameterName, CustomDatum x) throws java.sql.SQLException
java.sql.SQLException
void setORAData(java.lang.String parameterName, ORAData x) throws java.sql.SQLException
java.sql.SQLException
void setObject(java.lang.String parameterName, java.lang.Object x, int targetSqlType, int scale) throws java.sql.SQLException
java.lang
equivalent objects should be used.
The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the interface SQLData
), the JDBC driver should call the method SQLData.writeSQL
to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref
, Blob
, Clob
, Struct
, or Array
, the driver should pass it to the database as a value of the corresponding SQL type.
Note that this method may be used to pass database- specific abstract data types.
setObject
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the object containing the input parameter valuetargetSqlType
- the SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.scale
- for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, this is the number of digits after the decimal point. For all other types, this value will be ignored.java.sql.SQLException
- if a database access error occursTypes
, CallableStatement.getObject(int)
void setObject(java.lang.String parameterName, java.lang.Object x, int y) throws java.sql.SQLException
setObject
above, except that it assumes a scale of zero.setObject
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the object containing the input parameter valuetargetSqlType
- the SQL type (as defined in java.sql.Types) to be sent to the databasejava.sql.SQLException
- if a database access error occursCallableStatement.getObject(int)
void setRefType(java.lang.String parameterName, REF x) throws java.sql.SQLException
java.sql.SQLException
void setRef(java.lang.String parameterName, java.sql.Ref x) throws java.sql.SQLException
java.sql.SQLException
void setREF(java.lang.String parameterName, REF x) throws java.sql.SQLException
java.sql.SQLException
void setObject(java.lang.String parameterName, java.lang.Object x) throws java.sql.SQLException
Object
; therefore, the java.lang
equivalent objects should be used for built-in types.
The JDBC specification specifies a standard mapping from Java Object
types to SQL types. The given argument will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass database- specific abstract data types, by using a driver-specific Java type. If the object is of a class implementing the interface SQLData
, the JDBC driver should call the method SQLData.writeSQL
to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref
, Blob
, Clob
, Struct
, or Array
, the driver should pass it to the database as a value of the corresponding SQL type.
This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of the interfaces named above.
setObject
in interface java.sql.CallableStatement
parameterName
- the name of the parameterx
- the object containing the input parameter valuejava.sql.SQLException
- if a database access error occurs or if the given Object
parameter is ambiguousCallableStatement.getObject(int)
void setOracleObject(java.lang.String parameterName, Datum x) throws java.sql.SQLException
java.sql.SQLException
|
Oracle® Database JDBC Java API Reference 11g Release 2 ("11.2.0.0.1-Beta-1") BETA E13995-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |