Interface OraclePreparedStatement
-
- All Superinterfaces:
java.lang.AutoCloseable
,OracleCommonPreparedStatement
,OracleCommonStatement
,OracleStatement
,java.sql.PreparedStatement
,java.sql.Statement
,java.sql.Wrapper
- All Known Subinterfaces:
OracleCallableStatement
public interface OraclePreparedStatement extends OracleCommonPreparedStatement, OracleStatement
This interface defines the Oracle extensions to the standard JDBC interfacejava.sql.PreparedStatement
. You can usejava.sql.PreparedStatement
in your application where you do not make use of the Oracle extensions. However, when your application uses the Oracle extensions tojava.sql.PreparedStatement
you must cast your prepared statement object to the typeoracle.jdbc.OraclePreparedStatement
. Although the type by which the java compiler will identify the statement object is changed, the object itself is unchanged.Extended functionality consists of
setXXX()
methods for bindingoracle.sql.
types and objects into prepared statements, and methods to support Oracle performance extensions on a statement-by-statements basis.About prepared statements : To write changes to the database, such as for
INSERT
orUPDATE
operations, you will typically create aPreparedStatement
object. This allows you to execute a statement with varying sets of input parameters. TheprepareStatement()
method of your JDBCConnection
object allows you to define a statement that takes variable bind parameters, and returns a JDBCPreparedStatement
object with your statement definition.Bind your data : Use
setXXX()
methods on thePreparedStatement
object to bind data into the prepared statement to be sent to the database. Again, some of these methods are Oracle specific and require that you cast yourPreparedStatement
object to theOraclePreparedStatement
type.For example, if you have a
Connection
object namedconn
and a RAW namedmy_raw
, then write the RAW to the database as follows:PreparedStatement ps = conn.prepareStatement ("INSERT INTO raw_table VALUES(?)"); ((OraclePreparedStatement)ps).setRAW(1, my_raw); ps.execute();
- Since:
- 8.1.7
- See Also:
Connection.prepareStatement
-
-
Field Summary
Fields Modifier and Type Field Description static short
FORM_CHAR
Specifies the "form of use" for SQL CHAR datatypes (CHAR, VARCHAR2 and CLOB).static short
FORM_NCHAR
Specifies the "form of use" for SQL NCHAR datatypes (NCHAR, NVARCHAR2 and NCLOB).-
Fields inherited from interface oracle.jdbc.OracleStatement
EXPLICIT, IMPLICIT, NEW
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
defineParameterType(int param_index, int type, int max_size)
Define the type under which you will bind the parameter and the maximum size (in characters) of data you will bind in binds.void
defineParameterTypeBytes(int param_index, int type, int max_size)
Define the type under which you will bind the parameter and the maximum size (in bytes) of data you will bind in binds.void
defineParameterTypeChars(int param_index, int type, int max_size)
Define the type under which you will bind the parameter and the maximum size (in characters) of data you will bind in binds.java.util.concurrent.Flow.Publisher<OracleResultSet>
executeQueryAsyncOracle()
Executes the SQL query in thisPreparedStatement
object asynchronously and returns aPublisher
which publishes a singleResultSet
containing the rows produced.int
executeUpdateAndSuspend()
Executes the SQL statement in thisPreparedStatement
object, which must be an SQL Data Manipulation Language (DML) statement, such asINSERT
,UPDATE
orDELETE
; or an SQL statement that returns nothing, such as a DDL statement.default int
getExecuteBatch()
Deprecated.As of 12.1 all APIs related to oracle-style statement batching are deprecated in favor of standard JDBC batching.java.sql.ResultSet
getReturnResultSet()
Returns result set that contains data returned from DML Returning.OracleParameterMetaData
OracleGetParameterMetaData()
Retrieves the number, types and properties of thisPreparedStatement
object's parameters.void
registerReturnParameter(int paramIndex, int externalType)
Registers return parameter for DML Returning.void
registerReturnParameter(int paramIndex, int externalType, int maxSize)
Registers return parameter for DML Returning.void
registerReturnParameter(int paramIndex, int externalType, java.lang.String typeName)
Registers return parameter for DML Returning.int
sendBatch()
Deprecated.As of 12.1 all APIs related to oracle-style statement batching are deprecated in favor of standard JDBC batching.void
setARRAY(int parameterIndex, ARRAY arr)
Binds the designated parameter to aoracle.sql.ARRAY
.void
setArrayAtName(java.lang.String parameterName, java.sql.Array value)
Sets the designated parameter to a Java Array value.void
setARRAYAtName(java.lang.String parameterName, ARRAY value)
Sets the designated parameter to aoracle.sql.ARRAY
value.void
setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream)
Sets the designated parameter to a Java AsciiStream value.void
setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length)
Sets the designated parameter to a Java AsciiStream value.void
setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream, long length)
Sets the designated parameter to a Java AsciiStream value.void
setBfile(int parameterIndex, BFILE file)
Binds the designated parameter to aoracle.sql.BFILE
value.void
setBFILE(int parameterIndex, BFILE file)
Binds the designated parameter to aoracle.sql.BFILE
value.void
setBfileAtName(java.lang.String parameterName, BFILE value)
Sets the designated parameter to aoracle.sql.BFILE
value.void
setBFILEAtName(java.lang.String parameterName, BFILE value)
Sets the designated parameter to aoracle.sql.BFILE
value.void
setBigDecimalAtName(java.lang.String parameterName, java.math.BigDecimal value)
Sets the designated parameter to a Java BigDecimal value.void
setBinaryDouble(int parameterIndex, double value)
Sets the designated parameter to a Java double value.void
setBinaryDouble(int parameterIndex, BINARY_DOUBLE value)
Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value.void
setBinaryDoubleAtName(java.lang.String parameterName, double value)
Sets the designated parameter to a Java Double value.void
setBinaryDoubleAtName(java.lang.String parameterName, BINARY_DOUBLE value)
Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value.void
setBinaryFloat(int parameterIndex, float value)
Sets the designated parameter to a Java float value.void
setBinaryFloat(int parameterIndex, BINARY_FLOAT value)
Sets the designated parameter to an oracle.sql.BINARY_FLOAT value.void
setBinaryFloatAtName(java.lang.String parameterName, float value)
Sets the designated parameter to a Java Float value.void
setBinaryFloatAtName(java.lang.String parameterName, BINARY_FLOAT value)
Sets the designated parameter to an oracle.sql.BINARY_FLOAT value.void
setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream)
Sets the designated parameter to a Java BinaryStream value.void
setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length)
Sets the designated parameter to a Java BinaryStream value.void
setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream, long length)
Sets the designated parameter to a Java BinaryStream value.void
setBLOB(int parameterIndex, BLOB lob)
Binds the designated parameter to aoracle.sql.BLOB
value.void
setBlobAtName(java.lang.String parameterName, java.io.InputStream stream)
Sets the designated parameter to a stream value.void
setBlobAtName(java.lang.String parameterName, java.io.InputStream stream, long length)
Sets the designated parameter to a stream value.void
setBlobAtName(java.lang.String parameterName, java.sql.Blob value)
Sets the designated parameter to a Java Blob value.void
setBLOBAtName(java.lang.String parameterName, BLOB value)
Sets the designated parameter to an oracle.sql.BLOB value.void
setBooleanAtName(java.lang.String parameterName, boolean value)
Sets the designated parameter to a Java Boolean value.void
setByteAtName(java.lang.String parameterName, byte value)
Sets the designated parameter to a Java Byte value.void
setBytesAtName(java.lang.String parameterName, byte[] value)
Sets the designated parameter to a Java Bytes value.void
setBytesForBlob(int parameterIndex, byte[] value)
Sets the designated parameter to a Java bytes value.void
setBytesForBlobAtName(java.lang.String parameterName, byte[] value)
Sets the designated parameter to a Java byte array value.void
setCHAR(int parameterIndex, CHAR ch)
Binds the designated parameter to aoracle.sql.CHAR
value.void
setCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader)
Sets the designated parameter to a Java CharacterStream value.void
setCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader, long length)
Sets the designated parameter to a Java CharacterStream value.void
setCHARAtName(java.lang.String parameterName, CHAR value)
Sets the designated parameter to an oracle.sql.CHAR value.void
setCheckBindTypes(boolean flag)
Enable/disable bind type checking.void
setCLOB(int parameterIndex, CLOB lob)
Binds the designated parameter to aoracle.sql.CLOB
value.void
setClobAtName(java.lang.String parameterName, java.io.Reader reader)
Sets the designated parameter to a stream value.void
setClobAtName(java.lang.String parameterName, java.io.Reader reader, long length)
Sets the designated parameter to a stream value.void
setClobAtName(java.lang.String parameterName, java.sql.Clob value)
Sets the designated parameter to a Java Clob value.void
setCLOBAtName(java.lang.String parameterName, CLOB value)
Sets the designated parameter to an oracle.sql.CLOB value.void
setCursor(int parameterIndex, java.sql.ResultSet rs)
Deprecated.void
setCursorAtName(java.lang.String parameterName, java.sql.ResultSet value)
Sets the designated parameter to a Java Cursor value.void
setCustomDatum(int parameterIndex, CustomDatum x)
Deprecated.void
setCustomDatumAtName(java.lang.String parameterName, CustomDatum value)
Sets the designated parameter to a Java CustomDatum value.void
setDATE(int parameterIndex, DATE date)
Binds the designated parameter to aoracle.sql.DATE
value.void
setDateAtName(java.lang.String parameterName, java.sql.Date value)
Sets the designated parameter to a Java Date value.void
setDateAtName(java.lang.String parameterName, java.sql.Date value, java.util.Calendar cal)
Sets the designated parameter to a Java Date value.void
setDATEAtName(java.lang.String parameterName, DATE value)
Sets the designated parameter to an oracle.sql.DATE value.void
setDisableStmtCaching(boolean cache)
Don't Cache this object even when the corresponding Connection is Cache Enabled.void
setDoubleAtName(java.lang.String parameterName, double value)
Sets the designated parameter to a Java Double value.default void
setExecuteBatch(int batchValue)
Deprecated.As of 12.1 all APIs related to oracle-style statement batching are deprecated in favor of standard JDBC batching.void
setFixedCHAR(int parameterIndex, java.lang.String x)
Sets the designated parameter to aString
and executes a non-padded comparison with a SQL CHAR.void
setFixedCHARAtName(java.lang.String parameterName, java.lang.String value)
Sets the designated parameter to a Java FixedCHAR value.void
setFloatAtName(java.lang.String parameterName, float value)
Sets the designated parameter to a Java Float value.void
setFormOfUse(int parameterIndex, short formOfUse)
Specifies if the data is bound for a SQL NCHAR datatype.void
setIntAtName(java.lang.String parameterName, int value)
Sets the designated parameter to a Java Int value.void
setINTERVALDS(int parameterIndex, INTERVALDS x)
Binds the designated parameter to an oracle.sql.INTERVALDS value.void
setINTERVALDSAtName(java.lang.String parameterName, INTERVALDS value)
Sets the designated parameter to an oracle.sql.INTERVALDS value.void
setINTERVALYM(int parameterIndex, INTERVALYM x)
Binds the designated parameter to an oracle.sql.INTERVALYM value.void
setINTERVALYMAtName(java.lang.String parameterName, INTERVALYM value)
Sets the designated parameter to an oracle.sql.INTERVALYM value.void
setLongAtName(java.lang.String parameterName, long value)
Sets the designated parameter to a Java Long value.void
setNCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader)
Sets the designated parameter to a Java CharacterStream value using the NCHAR character set.void
setNCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader, long length)
Sets the designated parameter to a Java CharacterStream value using the NCHAR character set.void
setNClobAtName(java.lang.String parameterName, java.io.Reader reader)
Sets the designated parameter to ajava.sql.NClob
value.void
setNClobAtName(java.lang.String parameterName, java.io.Reader reader, long length)
Sets the designated parameter to ajava.sql.NClob
value.void
setNClobAtName(java.lang.String parameterName, java.sql.NClob value)
Sets the designated parameter to ajava.sql.NClob
value.void
setNStringAtName(java.lang.String parameterName, java.lang.String value)
Sets the designated parameter to ajava.sql.String
value using the NCHAR character setvoid
setNullAtName(java.lang.String parameterName, int sqlType)
Sets the designated parameter to a SQL NULL value.void
setNullAtName(java.lang.String parameterName, int sqlType, java.lang.String sqlName)
Sets the designated parameter to a SQL NULL value.void
setNUMBER(int parameterIndex, NUMBER num)
Binds the designated parameter to aoracle.sql.NUMBER
value.void
setNUMBERAtName(java.lang.String parameterName, NUMBER value)
Sets the designated parameter to anoracle.sql.NUMBER
value.void
setObjectAtName(java.lang.String parameterName, java.lang.Object value)
Sets the designated parameter to a Java Object value.void
setObjectAtName(java.lang.String parameterName, java.lang.Object value, int targetSqlType)
Sets the designated parameter to a Java Object value.void
setObjectAtName(java.lang.String parameterName, java.lang.Object value, int targetSqlType, int scale)
Sets the designated parameter to a Java Object value.void
setOPAQUE(int parameterIndex, OPAQUE val)
Binds the designated parameter to aoracle.sql.OPAQUE
value.void
setOPAQUEAtName(java.lang.String parameterName, OPAQUE value)
Sets the designated parameter to anoracle.sql.OPAQUE
value.void
setOracleObject(int parameterIndex, Datum x)
Binds the designated parameter to aoracle.sql.Datum
value.void
setOracleObjectAtName(java.lang.String parameterName, Datum value)
Sets the designated parameter to anoracle.sql.Datum
value.void
setORAData(int parameterIndex, ORAData x)
Binds the designated parameter to aoracle.sql.ORAData
value.void
setORADataAtName(java.lang.String parameterName, ORAData value)
Sets the designated parameter to anoracle.sql.ORAData
value.void
setPlsqlIndexTable(int parameterIndex, java.lang.Object arrayData, int maxLen, int curLen, int elemSqlType, int elemMaxLen)
Deprecated.since 18.1.void
setRAW(int parameterIndex, RAW raw)
Binds the designated parameter to aoracle.sql.RAW
value.void
setRAWAtName(java.lang.String parameterName, RAW value)
Sets the designated parameter to anoracle.sql.RAW
value.void
setREF(int parameterIndex, REF ref)
Binds the designated parameter to aoracle.sql.REF
value.void
setRefAtName(java.lang.String parameterName, java.sql.Ref value)
Sets the designated parameter to a Java Ref value.void
setREFAtName(java.lang.String parameterName, REF value)
Sets the designated parameter to anoracle.sql.REF
value.void
setRefType(int parameterIndex, REF ref)
Binds the designated parameter to aoracle.sql.REF
value.void
setRefTypeAtName(java.lang.String parameterName, REF value)
Sets the designated parameter to anoracle.sql.REF
value.void
setROWID(int parameterIndex, ROWID rowid)
Binds the designated parameter to aoracle.sql.ROWID
value.void
setRowIdAtName(java.lang.String parameterName, java.sql.RowId value)
Sets the designated parameter to ajava.sql.RowId
value.void
setROWIDAtName(java.lang.String parameterName, ROWID value)
Sets the designated parameter to anoracle.sql.ROWID
value.void
setShortAtName(java.lang.String parameterName, short value)
Sets the designated parameter to a Java Short value.void
setSQLXMLAtName(java.lang.String parameterName, java.sql.SQLXML value)
Sets the designated parameter to ajava.sql.SQLXML
value.void
setStringAtName(java.lang.String parameterName, java.lang.String value)
Sets the designated parameter to a Java String value.void
setStringForClob(int parameterIndex, java.lang.String value)
Sets the designated parameter to a Java String value.void
setStringForClobAtName(java.lang.String parameterName, java.lang.String value)
Sets the designated parameter to a Java String value.void
setSTRUCT(int parameterIndex, STRUCT struct)
Binds the designated parameter to aoracle.sql.STRUCT
value.void
setSTRUCTAtName(java.lang.String parameterName, STRUCT value)
Sets the designated parameter to anoracle.sql.STRUCT
value.void
setStructDescriptor(int parameterIndex, StructDescriptor desc)
Binds the bind type of designated parameter from an oracle.sql.StructDescriptor.void
setStructDescriptorAtName(java.lang.String parameterName, StructDescriptor desc)
Sets the designated parameter to anoracle.sql.StructDescriptor
value.void
setTimeAtName(java.lang.String parameterName, java.sql.Time value)
Sets the designated parameter to a Java Time value.void
setTimeAtName(java.lang.String parameterName, java.sql.Time value, java.util.Calendar cal)
Sets the designated parameter to a Java Time value.void
setTIMESTAMP(int parameterIndex, TIMESTAMP x)
Binds the designated parameter to an oracle.sql.TIMESTAMP value.void
setTimestampAtName(java.lang.String parameterName, java.sql.Timestamp value)
Sets the designated parameter to a Java Timestamp value.void
setTimestampAtName(java.lang.String parameterName, java.sql.Timestamp value, java.util.Calendar cal)
Sets the designated parameter to a Java Timestamp value.void
setTIMESTAMPAtName(java.lang.String parameterName, TIMESTAMP value)
Sets the designated parameter to anoracle.sql.TIMESTAMP
value.void
setTIMESTAMPLTZ(int parameterIndex, TIMESTAMPLTZ x)
Binds the designated parameter to anoracle.sql.TIMESTAMPLTZ
value.void
setTIMESTAMPLTZAtName(java.lang.String parameterName, TIMESTAMPLTZ value)
Sets the designated parameter to anoracle.sql.TIMESTAMPLTZ
value.void
setTIMESTAMPTZ(int parameterIndex, TIMESTAMPTZ x)
Binds the designated parameter to anoracle.sql.TIMESTAMPTZ
value.void
setTIMESTAMPTZAtName(java.lang.String parameterName, TIMESTAMPTZ value)
Sets the designated parameter to anoracle.sql.TIMESTAMPTZ
value.void
setUnicodeStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length)
Sets the designated parameter to a Java UnicodeStream value.void
setURLAtName(java.lang.String parameterName, java.net.URL value)
Sets the designated parameter to a Java URL value.-
Methods inherited from interface oracle.jdbc.OracleCommonPreparedStatement
executeAsyncOracle, executeBatchAsyncOracle, executeUpdateAsyncOracle
-
Methods inherited from interface oracle.jdbc.OracleCommonStatement
continueOnError
-
Methods inherited from interface oracle.jdbc.OracleStatement
clearDefines, closeOnCompletion, closeWithKey, creationState, defineColumnType, defineColumnType, defineColumnType, defineColumnType, defineColumnTypeBytes, defineColumnTypeChars, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, getLobPrefetchSize, getRegisteredQueryId, getRegisteredTableNames, getRowPrefetch, getSqlId, isNCHAR, isSimpleIdentifier, setDatabaseChangeRegistration, setEscapeProcessing, setLobPrefetchSize, setRowPrefetch
-
Methods inherited from interface java.sql.PreparedStatement
addBatch, clearParameters, execute, executeLargeUpdate, 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, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
Field Detail
-
FORM_NCHAR
static final short FORM_NCHAR
Specifies the "form of use" for SQL NCHAR datatypes (NCHAR, NVARCHAR2 and NCLOB). It is used only in the argument tosetFormOfUse()
.- See Also:
- Constant Field Values
-
FORM_CHAR
static final short FORM_CHAR
Specifies the "form of use" for SQL CHAR datatypes (CHAR, VARCHAR2 and CLOB). It is used only in the argument tosetFormOfUse()
.- See Also:
- Constant Field Values
-
-
Method Detail
-
defineParameterTypeBytes
void defineParameterTypeBytes(int param_index, int type, int max_size) throws java.sql.SQLException
Define the type under which you will bind the parameter and the maximum size (in bytes) of data you will bind in binds.Similarly to
defineColumnType()
. Before executing a Query you may choose to inform JDBC of the type and maximum length of the bind parameter. If not, based on thesetXXX
call, the maximum length of the type is taken, i.e., for a setString a 4k buffer is allocated. This API does not reduce the network round trip. It is purely a memory optimization API.Note: You should use
OracleTypes.CHAR
as the type value if you are going bind later assetCHAR
and useOracleTypes.VARCHAR
if you are going to bind assetString
for effective results.- Parameters:
param_index
- Index of bind parameter (should be >=0)type
- Type to be assigned to bind parameter. This type could be different from the native type of the column. Appropriate conversions will be done.max_size
- Maximum length of bind data in bytes (should be >=0)- Throws:
java.sql.SQLException
- if the type you specify is not available
-
defineParameterTypeChars
void defineParameterTypeChars(int param_index, int type, int max_size) throws java.sql.SQLException
Define the type under which you will bind the parameter and the maximum size (in characters) of data you will bind in binds.Similarly to
defineColumnType()
. Before executing a Query you may choose to inform JDBC of the type and maximum length of the bind parameter. If not, based on thesetXXX
call, the maximum length of the type is taken, i.e., for a setString a 4k buffer is allocated. This API does not reduce the network round trip. It is purely a memory optimization API.Note: You should use
OracleTypes.CHAR
as the type value if you are going bind later assetCHAR
and useOracleTypes.VARCHAR
if you are going to bind assetString
for effective results.- Parameters:
param_index
- Index of bind parameter (should be >=0)type
- Type to be assigned to bind parameter. This type could be different from the native type of the column. Appropriate conversions will be done.max_size
- Maximum length of bind data in bytes (should be >=0)- Throws:
java.sql.SQLException
- if the type you specify is not available
-
defineParameterType
void defineParameterType(int param_index, int type, int max_size) throws java.sql.SQLException
Define the type under which you will bind the parameter and the maximum size (in characters) of data you will bind in binds. Depending on the value of the dataSizeUnits connection property, max_size will be measured in bytes or characters.- Parameters:
param_index
-type
-max_size
-- Throws:
java.sql.SQLException
-
getExecuteBatch
default int getExecuteBatch()
Deprecated.As of 12.1 all APIs related to oracle-style statement batching are deprecated in favor of standard JDBC batching. We recommend using the standard model going forward as it is spec compliant and provides more information and control to the application.Executions are not batched but sent immediately. Oracle style of batching has been deprecated in 12.1 and made a no-op in 12.2. We recommend using the standard model of batching.- Returns:
- the batch value (always 1).
- See Also:
OracleConnection.setDefaultExecuteBatch
,setExecuteBatch
-
sendBatch
int sendBatch() throws java.sql.SQLException
Deprecated.As of 12.1 all APIs related to oracle-style statement batching are deprecated in favor of standard JDBC batching. We recommend using the standard model going forward as it is spec compliant and provides more information and control to the application.Executions are not batched but sent immediately. Oracle style of batching has been deprecated in 12.1 and made a no-op in 12.2. We recommend using the standard model of batching.- Returns:
- the update count (always 0).
- Throws:
java.sql.SQLException
- never thrown.
-
setARRAY
void setARRAY(int parameterIndex, ARRAY arr) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.ARRAY
.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...arr
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBfile
void setBfile(int parameterIndex, BFILE file) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.BFILE
value.Note: This is the same as
setBFILE
.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...file
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs- See Also:
setBFILE
-
setBFILE
void setBFILE(int parameterIndex, BFILE file) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.BFILE
value.Note: An instance of the
oracle.sql.BFILE
class contains only the locator of the BFILE, not the data. Thus, this method binds the designated parameter to a BFILE locator not to the data.For example, assume you want to insert a BFILE locator into a table, and you have an
OraclePreparedStatement
objectops
to insert data into a table. The first column is a string (to designate a row number), the second column is a BFILE, and you have a validoracle.sql.BFILE
object (bfile
). Write the BFILE to the database as follows:OraclePreparedStatement ops = (OraclePreparedStatement)conn.prepareStatement ("INSERT INTO my_bfile_table VALUES(?,?)"); ops.setString(1, "one"); ops.setBFILE(2, bfile); ops.execute();
This stores only the locator of the BFILE in the
my_bfile_table
. See theBFILE
class to get more details about how to deal with the data.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...file
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBLOB
void setBLOB(int parameterIndex, BLOB lob) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.BLOB
value.Note: An instance of the
oracle.sql.BLOB
class contains only the locator of the BLOB, not the data. Thus, this method binds the designated parameter to a BLOB locator not to the data.For example, if you have an
OraclePreparedStatement
objectops
and a BLOB namedmy_blob
, then write the BLOB to the database as follows:OraclePreparedStatement ops = (OraclePreparedStatement)conn.prepareStatement ("INSERT INTO blob_table VALUES(?)"); ops.setBLOB(1, my_blob); ops.execute();
This stores only the locator of the BLOB in the
clob_table
. Use the methodBLOB.getBinaryOutputStream
to write data to a BLOB.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...lob
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCHAR
void setCHAR(int parameterIndex, CHAR ch) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.CHAR
value.setCHAR
checks the character set of the argument. If it is not the same as the network character set, then the bytes of the argument are converted to the network character set and those bytes are sent to the database. The conversion between the argument character set and the network character set is via the Universal Character Set (UCS2). That is, the argument is converted to UCS2, then the UCS2 bytes are converted to the network character set.Note: If an input character does not have a representation in UCS2, or if the UCS2 does not have a representation of the network character set,
setCHAR
will throw an exception.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...ch
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs- See Also:
setFixedChar
-
setCLOB
void setCLOB(int parameterIndex, CLOB lob) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.CLOB
value.Note: An instance of the
oracle.sql.CLOB
class contains only the locator of the CLOB, not the data. Thus, this method binds the designated parameter to a CLOB locator not to the data.For example, if you have an
OraclePreparedStatement
objectops
and a CLOB namedmy_clob
, then write the CLOB to the database as follows:OraclePreparedStatement ops = (OraclePreparedStatement)conn.prepareStatement ("INSERT INTO clob_table VALUES(?)"); ops.setCLOB(1, my_clob); ops.execute();
This stores only the locator of the CLOB in the
clob_table
. Use the methodsCLOB.getCharacterOutputStream
orCLOB.getAsciiOutputStream
to write data to a CLOB.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...lob
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCursor
void setCursor(int parameterIndex, java.sql.ResultSet rs) throws java.sql.SQLException
Deprecated.Binds the designated parameter to ajava.sql.ResultSet
. This is used for RefCursor parameter only.NOTE: The method is a misnomer. You should use CURSOR only in callable statements.
- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...rs
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs- See Also:
OracleCallableStatement.getCursor
-
setCustomDatum
void setCustomDatum(int parameterIndex, CustomDatum x) throws java.sql.SQLException
Deprecated.Binds the designated parameter to aoracle.sql.CustomDatum
value.In the 9i release the
oracle.sql.CustomDatum
has been deprecated and replaced by theoracle.sql.ORAData
interface. For this reason, this method is also deprecated. It is recommended to usesetORAData()
instead.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value, should not be null.- Throws:
java.sql.SQLException
- if a database access error occurs, or if null value is passed as x.
-
setORAData
void setORAData(int parameterIndex, ORAData x) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.ORAData
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value, should not be null.- Throws:
java.sql.SQLException
- if a database access error occurs, or if null value is passed as x.
-
setDATE
void setDATE(int parameterIndex, DATE date) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.DATE
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...date
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setExecuteBatch
default void setExecuteBatch(int batchValue) throws java.sql.SQLException
Deprecated.As of 12.1 all APIs related to oracle-style statement batching are deprecated in favor of standard JDBC batching. We recommend using the standard model going forward as it is spec compliant and provides more information and control to the application.Executions are not batched but sent immediately. Oracle style of batching has been deprecated in 12.1 and made a no-op in 12.2. We recommend using the standard model of batching.- Parameters:
batchValue
- batch value to be set, this is discarded.- Throws:
java.sql.SQLException
- ifbatchValue
is less than 1 (never thrown).- See Also:
getExecuteBatch
,OracleConnection.setDefaultExecuteBatch
-
setFixedCHAR
void setFixedCHAR(int parameterIndex, java.lang.String x) throws java.sql.SQLException
Sets the designated parameter to aString
and executes a non-padded comparison with a SQL CHAR.CHAR data in the database is padded to the column width. This leads to a limitation in using the
setCHAR()
method to bind character data into theWHERE
clause of aSELECT
statement--the character data in theWHERE
clause must also be padded to the column width to produce a match in theSELECT
statement. This is especially troublesome if you do not know the column width.setFixedCHAR()
remedies this. This method executes a non-padded comparison.Notes:
- Remember to cast your prepared statement object to
OraclePreparedStatement
to use thesetFixedCHAR()
method. - There is no need to use setFixedCHAR() for an INSERT statement. The database always automatically pads the data to the column width as it inserts it.
The following example demonstrates the difference between the
setString()
,setCHAR()
andsetFixedCHAR()
methods.// Schema is : create table my_table (col1 char(10)); // insert into my_table values ('JDBC'); PreparedStatement pstmt = conn.prepareStatement ("select count() from my_table where col1 = ?"); ResultSet rs; pstmt.setString (1, "JDBC"); // Set the Bind Value rs = pstmt.executeQuery(); // This does not match any row // ... do something with rs CHAR ch = new CHAR("JDBC ", null); ((OraclePreparedStatement)pstmt).setCHAR(1, ch); // Pad it to 10 bytes rs = pstmt.executeQuery(); // This matches one row // ... do something with rs ((OraclePreparedStatement)pstmt).setFixedCHAR(1, "JDBC"); rs = pstmt.executeQuery(); // This matches one row // ... do something with rs
- Parameters:
parameterIndex
- index of the bind variable (first is 1)x
- the literal/variable to be bound.- Throws:
java.sql.SQLException
- if an error occurs while binding- See Also:
setCHAR
- Remember to cast your prepared statement object to
-
setNUMBER
void setNUMBER(int parameterIndex, NUMBER num) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.NUMBER
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...num
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryFloat
void setBinaryFloat(int parameterIndex, float value) throws java.sql.SQLException
Sets the designated parameter to a Java float value. The float data is converted to the server internal BINARY_FLOAT format before being sent to the server.Note that with the JDBC standard setFloat API the float data is converted to server internal NUMBER format before being sent to the server. In Oracle the SQL REAL, FLOAT, and DOUBLE PRECISION datatypes are NUMBER types.
The connection property SetFloatAndDoubleUseBinary causes the setFloat API to use binary conversion.
Binary conversion sent to a BINARY_FLOAT parameter is fast and a bit exact. Binary conversion sent to a NUMBER parameter moves CPU load to the server but the data will be the same as NUMBER conversion on the client.
NUMBER conversion sent to a NUMBER parameter is correct and keeps the CPU load on the client. NUMBER conversion sent to a BINARY_FLOAT parameter is not a bit exact and has extra CPU load on both client and server
- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs- Since:
- 10gR1
-
setBinaryFloat
void setBinaryFloat(int parameterIndex, BINARY_FLOAT value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_FLOAT value. See setBinaryFloat for additional information.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryDouble
void setBinaryDouble(int parameterIndex, double value) throws java.sql.SQLException
Sets the designated parameter to a Java double value. The double data is converted to the server internal BINARY_DOUBLE format before being sent to the server.Note that with the JDBC standard setDouble API the float data is converted to server internal NUMBER format before being sent to the server. In Oracle the SQL REAL, FLOAT, and DOUBLE PRECISION datatypes are NUMBER types.
The connection property SetFloatAndDoubleUseBinary causes the setDouble API to use binary conversion.
Binary conversion sent to a BINARY_DOUBLE parameter is fast and a bit exact. Binary conversion sent to a NUMBER parameter moves CPU load to the server but the data will be the same as NUMBER conversion on the client.
NUMBER conversion sent to a NUMBER parameter is correct and keeps the CPU load on the client. NUMBER conversion sent to a BINARY_DOUBLE parameter is not a bit exact and has extra CPU load on both client and server
- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryDouble
void setBinaryDouble(int parameterIndex, BINARY_DOUBLE value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value. See setBinaryDouble for additional information.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setOPAQUE
void setOPAQUE(int parameterIndex, OPAQUE val) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.OPAQUE
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...val
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setOracleObject
void setOracleObject(int parameterIndex, Datum x) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.Datum
value.This is a generic
setXXX()
method for bindingoracle.sql.
data into a prepared statement as anoracle.sql.Datum
object.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setStructDescriptor
void setStructDescriptor(int parameterIndex, StructDescriptor desc) throws java.sql.SQLException
Binds the bind type of designated parameter from an oracle.sql.StructDescriptor.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...desc
- the StructDescriptor to bind- Throws:
java.sql.SQLException
- if a database access error occurs
-
setRAW
void setRAW(int parameterIndex, RAW raw) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.RAW
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...raw
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setREF
void setREF(int parameterIndex, REF ref) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.REF
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...ref
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setRefType
void setRefType(int parameterIndex, REF ref) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.REF
value.Note: This is the same as
setREF
.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...ref
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs- See Also:
setREF
-
setROWID
void setROWID(int parameterIndex, ROWID rowid) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.ROWID
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...rowid
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setSTRUCT
void setSTRUCT(int parameterIndex, STRUCT struct) throws java.sql.SQLException
Binds the designated parameter to aoracle.sql.STRUCT
value.- Parameters:
parameterIndex
- the first parameter is 1, the second is 2, ...struct
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTIMESTAMP
void setTIMESTAMP(int parameterIndex, TIMESTAMP x) throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.TIMESTAMP value.- Parameters:
parameterIndex
- specifies the parameter index. Index starts from 1.x
- specifies the parameter value.- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 9i
-
setTIMESTAMPTZ
void setTIMESTAMPTZ(int parameterIndex, TIMESTAMPTZ x) throws java.sql.SQLException
Binds the designated parameter to anoracle.sql.TIMESTAMPTZ
value.- Parameters:
parameterIndex
- specifies the parameter index. Index starts from 1.x
- specifies the parameter value.- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 9i
-
setTIMESTAMPLTZ
void setTIMESTAMPLTZ(int parameterIndex, TIMESTAMPLTZ x) throws java.sql.SQLException
Binds the designated parameter to anoracle.sql.TIMESTAMPLTZ
value.In order to use this method, the calling program must first set the session time zone of the corresponding connection by using
OracleConnection.setSessionTimeZone()
.- Parameters:
parameterIndex
- specifies the parameter index. Index starts from 1.x
- specifies the parameter value.- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 9i
-
setINTERVALYM
void setINTERVALYM(int parameterIndex, INTERVALYM x) throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.INTERVALYM value.- Parameters:
parameterIndex
- specifies the parameter index. Index starts from 1.x
- specifies the parameter value.- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 9i
-
setINTERVALDS
void setINTERVALDS(int parameterIndex, INTERVALDS x) throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.INTERVALDS value.- Parameters:
parameterIndex
- specifies the parameter index. Index starts from 1.x
- specifies the parameter value.- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 10i
-
setNullAtName
void setNullAtName(java.lang.String parameterName, int sqlType, java.lang.String sqlName) throws java.sql.SQLException
Sets the designated parameter to a SQL NULL value.- Parameters:
parameterName
-sqlType
-sqlName
- the name of the SQL type- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNullAtName
void setNullAtName(java.lang.String parameterName, int sqlType) throws java.sql.SQLException
Sets the designated parameter to a SQL NULL value.- Parameters:
parameterName
-sqlType
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBooleanAtName
void setBooleanAtName(java.lang.String parameterName, boolean value) throws java.sql.SQLException
Sets the designated parameter to a Java Boolean value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setByteAtName
void setByteAtName(java.lang.String parameterName, byte value) throws java.sql.SQLException
Sets the designated parameter to a Java Byte value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setShortAtName
void setShortAtName(java.lang.String parameterName, short value) throws java.sql.SQLException
Sets the designated parameter to a Java Short value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setIntAtName
void setIntAtName(java.lang.String parameterName, int value) throws java.sql.SQLException
Sets the designated parameter to a Java Int value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setLongAtName
void setLongAtName(java.lang.String parameterName, long value) throws java.sql.SQLException
Sets the designated parameter to a Java Long value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setFloatAtName
void setFloatAtName(java.lang.String parameterName, float value) throws java.sql.SQLException
Sets the designated parameter to a Java Float value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setDoubleAtName
void setDoubleAtName(java.lang.String parameterName, double value) throws java.sql.SQLException
Sets the designated parameter to a Java Double value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryFloatAtName
void setBinaryFloatAtName(java.lang.String parameterName, float value) throws java.sql.SQLException
Sets the designated parameter to a Java Float value. See setBinaryFloat for additional information.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryFloatAtName
void setBinaryFloatAtName(java.lang.String parameterName, BINARY_FLOAT value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_FLOAT value. See setBinaryFloat for additional information.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryDoubleAtName
void setBinaryDoubleAtName(java.lang.String parameterName, double value) throws java.sql.SQLException
Sets the designated parameter to a Java Double value. See setBinaryDouble for additional information.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryDoubleAtName
void setBinaryDoubleAtName(java.lang.String parameterName, BINARY_DOUBLE value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value. See setBinaryDouble for additional information.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBigDecimalAtName
void setBigDecimalAtName(java.lang.String parameterName, java.math.BigDecimal value) throws java.sql.SQLException
Sets the designated parameter to a Java BigDecimal value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setStringAtName
void setStringAtName(java.lang.String parameterName, java.lang.String value) throws java.sql.SQLException
Sets the designated parameter to a Java String value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setStringForClob
void setStringForClob(int parameterIndex, java.lang.String value) throws java.sql.SQLException
Sets the designated parameter to a Java String value. For large strings this will only work correctly with a CLOB column.- Parameters:
parameterIndex
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setStringForClobAtName
void setStringForClobAtName(java.lang.String parameterName, java.lang.String value) throws java.sql.SQLException
Sets the designated parameter to a Java String value. For large strings this will only work correctly with a CLOB column.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setFixedCHARAtName
void setFixedCHARAtName(java.lang.String parameterName, java.lang.String value) throws java.sql.SQLException
Sets the designated parameter to a Java FixedCHAR value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCursorAtName
void setCursorAtName(java.lang.String parameterName, java.sql.ResultSet value) throws java.sql.SQLException
Sets the designated parameter to a Java Cursor value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setROWIDAtName
void setROWIDAtName(java.lang.String parameterName, ROWID value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.ROWID
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setArrayAtName
void setArrayAtName(java.lang.String parameterName, java.sql.Array value) throws java.sql.SQLException
Sets the designated parameter to a Java Array value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setARRAYAtName
void setARRAYAtName(java.lang.String parameterName, ARRAY value) throws java.sql.SQLException
Sets the designated parameter to aoracle.sql.ARRAY
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setOPAQUEAtName
void setOPAQUEAtName(java.lang.String parameterName, OPAQUE value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.OPAQUE
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setStructDescriptorAtName
void setStructDescriptorAtName(java.lang.String parameterName, StructDescriptor desc) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.StructDescriptor
value.- Parameters:
parameterName
-desc
- the StructDescriptor to bind- Throws:
java.sql.SQLException
- if a database access error occurs
-
setSTRUCTAtName
void setSTRUCTAtName(java.lang.String parameterName, STRUCT value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.STRUCT
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setRAWAtName
void setRAWAtName(java.lang.String parameterName, RAW value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.RAW
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCHARAtName
void setCHARAtName(java.lang.String parameterName, CHAR value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.CHAR value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setDATEAtName
void setDATEAtName(java.lang.String parameterName, DATE value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.DATE value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNUMBERAtName
void setNUMBERAtName(java.lang.String parameterName, NUMBER value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.NUMBER
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBLOBAtName
void setBLOBAtName(java.lang.String parameterName, BLOB value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BLOB value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBlobAtName
void setBlobAtName(java.lang.String parameterName, java.sql.Blob value) throws java.sql.SQLException
Sets the designated parameter to a Java Blob value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBlobAtName
void setBlobAtName(java.lang.String parameterName, java.io.InputStream stream, long length) throws java.sql.SQLException
Sets the designated parameter to a stream value.- Parameters:
parameterName
-stream
- the stream from which to read the valuelength
- the number of bytes to read- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBlobAtName
void setBlobAtName(java.lang.String parameterName, java.io.InputStream stream) throws java.sql.SQLException
Sets the designated parameter to a stream value.- Parameters:
parameterName
-stream
- the stream from which to read the value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCLOBAtName
void setCLOBAtName(java.lang.String parameterName, CLOB value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.CLOB value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setClobAtName
void setClobAtName(java.lang.String parameterName, java.sql.Clob value) throws java.sql.SQLException
Sets the designated parameter to a Java Clob value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setClobAtName
void setClobAtName(java.lang.String parameterName, java.io.Reader reader, long length) throws java.sql.SQLException
Sets the designated parameter to a stream value.- Parameters:
parameterName
-reader
- the Reader from which to get the valuelength
- the number of bytes to read- Throws:
java.sql.SQLException
- if a database access error occurs
-
setClobAtName
void setClobAtName(java.lang.String parameterName, java.io.Reader reader) throws java.sql.SQLException
Sets the designated parameter to a stream value.- Parameters:
parameterName
-reader
- the Reader from which to get the value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBFILEAtName
void setBFILEAtName(java.lang.String parameterName, BFILE value) throws java.sql.SQLException
Sets the designated parameter to aoracle.sql.BFILE
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBfileAtName
void setBfileAtName(java.lang.String parameterName, BFILE value) throws java.sql.SQLException
Sets the designated parameter to aoracle.sql.BFILE
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBytesAtName
void setBytesAtName(java.lang.String parameterName, byte[] value) throws java.sql.SQLException
Sets the designated parameter to a Java Bytes value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBytesForBlob
void setBytesForBlob(int parameterIndex, byte[] value) throws java.sql.SQLException
Sets the designated parameter to a Java bytes value. For large byte arrays this will only work correctly with a BLOB or LONG RAW column- Parameters:
parameterIndex
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBytesForBlobAtName
void setBytesForBlobAtName(java.lang.String parameterName, byte[] value) throws java.sql.SQLException
Sets the designated parameter to a Java byte array value. For large byte arrays this will only work correctly with a BLOB or LONG RAW column.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setDateAtName
void setDateAtName(java.lang.String parameterName, java.sql.Date value) throws java.sql.SQLException
Sets the designated parameter to a Java Date value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setDateAtName
void setDateAtName(java.lang.String parameterName, java.sql.Date value, java.util.Calendar cal) throws java.sql.SQLException
Sets the designated parameter to a Java Date value.- Parameters:
parameterName
-value
- the parameter valuecal
- the calendar to interpret the date- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTimeAtName
void setTimeAtName(java.lang.String parameterName, java.sql.Time value) throws java.sql.SQLException
Sets the designated parameter to a Java Time value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTimeAtName
void setTimeAtName(java.lang.String parameterName, java.sql.Time value, java.util.Calendar cal) throws java.sql.SQLException
Sets the designated parameter to a Java Time value.- Parameters:
parameterName
-value
- the parameter valuecal
- the Calendar to use to interpret the value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTimestampAtName
void setTimestampAtName(java.lang.String parameterName, java.sql.Timestamp value) throws java.sql.SQLException
Sets the designated parameter to a Java Timestamp value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTimestampAtName
void setTimestampAtName(java.lang.String parameterName, java.sql.Timestamp value, java.util.Calendar cal) throws java.sql.SQLException
Sets the designated parameter to a Java Timestamp value.- Parameters:
parameterName
-value
- the parameter valuecal
- the Calendar to use to interpret the date- Throws:
java.sql.SQLException
- if a database access error occurs
-
setINTERVALYMAtName
void setINTERVALYMAtName(java.lang.String parameterName, INTERVALYM value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.INTERVALYM value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setINTERVALDSAtName
void setINTERVALDSAtName(java.lang.String parameterName, INTERVALDS value) throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.INTERVALDS value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTIMESTAMPAtName
void setTIMESTAMPAtName(java.lang.String parameterName, TIMESTAMP value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.TIMESTAMP
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTIMESTAMPTZAtName
void setTIMESTAMPTZAtName(java.lang.String parameterName, TIMESTAMPTZ value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.TIMESTAMPTZ
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setTIMESTAMPLTZAtName
void setTIMESTAMPLTZAtName(java.lang.String parameterName, TIMESTAMPLTZ value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.TIMESTAMPLTZ
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setAsciiStreamAtName
void setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length) throws java.sql.SQLException
Sets the designated parameter to a Java AsciiStream value.- Parameters:
parameterName
-stream
- the stream valuelength
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setAsciiStreamAtName
void setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream, long length) throws java.sql.SQLException
Sets the designated parameter to a Java AsciiStream value.- Parameters:
parameterName
-stream
- the stream valuelength
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setAsciiStreamAtName
void setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream) throws java.sql.SQLException
Sets the designated parameter to a Java AsciiStream value.- Parameters:
parameterName
-stream
- the stream value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryStreamAtName
void setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length) throws java.sql.SQLException
Sets the designated parameter to a Java BinaryStream value.- Parameters:
parameterName
-stream
-length
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryStreamAtName
void setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream, long length) throws java.sql.SQLException
Sets the designated parameter to a Java BinaryStream value.- Parameters:
parameterName
-stream
-length
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setBinaryStreamAtName
void setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream) throws java.sql.SQLException
Sets the designated parameter to a Java BinaryStream value.- Parameters:
parameterName
-stream
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCharacterStreamAtName
void setCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader, long length) throws java.sql.SQLException
Sets the designated parameter to a Java CharacterStream value.- Parameters:
parameterName
-reader
-length
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCharacterStreamAtName
void setCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader) throws java.sql.SQLException
Sets the designated parameter to a Java CharacterStream value.- Parameters:
parameterName
-reader
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setUnicodeStreamAtName
void setUnicodeStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length) throws java.sql.SQLException
Sets the designated parameter to a Java UnicodeStream value.- Parameters:
parameterName
-stream
-length
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCustomDatumAtName
void setCustomDatumAtName(java.lang.String parameterName, CustomDatum value) throws java.sql.SQLException
Sets the designated parameter to a Java CustomDatum value.- Parameters:
parameterName
-value
- the parameter value, should not be null.- Throws:
java.sql.SQLException
- if a database access error occurs, of if null value is passed as value.
-
setORADataAtName
void setORADataAtName(java.lang.String parameterName, ORAData value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.ORAData
value.- Parameters:
parameterName
-value
- the parameter value, should not be null.- Throws:
java.sql.SQLException
- if a database access error occurs, or if null value is passed as value.
-
setObjectAtName
void setObjectAtName(java.lang.String parameterName, java.lang.Object value, int targetSqlType, int scale) throws java.sql.SQLException
Sets the designated parameter to a Java Object value.- Parameters:
parameterName
-value
- the parameter valuetargetSqlType
-scale
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setObjectAtName
void setObjectAtName(java.lang.String parameterName, java.lang.Object value, int targetSqlType) throws java.sql.SQLException
Sets the designated parameter to a Java Object value.- Parameters:
parameterName
-value
- the parameter valuetargetSqlType
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setRefTypeAtName
void setRefTypeAtName(java.lang.String parameterName, REF value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.REF
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setRefAtName
void setRefAtName(java.lang.String parameterName, java.sql.Ref value) throws java.sql.SQLException
Sets the designated parameter to a Java Ref value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setREFAtName
void setREFAtName(java.lang.String parameterName, REF value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.REF
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setObjectAtName
void setObjectAtName(java.lang.String parameterName, java.lang.Object value) throws java.sql.SQLException
Sets the designated parameter to a Java Object value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setOracleObjectAtName
void setOracleObjectAtName(java.lang.String parameterName, Datum value) throws java.sql.SQLException
Sets the designated parameter to anoracle.sql.Datum
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setURLAtName
void setURLAtName(java.lang.String parameterName, java.net.URL value) throws java.sql.SQLException
Sets the designated parameter to a Java URL value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setCheckBindTypes
void setCheckBindTypes(boolean flag)
Enable/disable bind type checking.When bind type checking is disabled, the Jdbc driver does not check bind types for every execute. It is intended to be used as a performance enhancement if the user knows for fact that bind types do not change across different executions. The default is
true
.- Parameters:
flag
- set it to false if Bind Types doesn't change
-
setPlsqlIndexTable
@Deprecated void setPlsqlIndexTable(int parameterIndex, java.lang.Object arrayData, int maxLen, int curLen, int elemSqlType, int elemMaxLen) throws java.sql.SQLException
Deprecated.since 18.1. Use java.sql.PreparedStatement.setObject(int parameterIndex, Object x).Binds a PL/SQL Associative Array parameter in the IN parameter mode.Associative Arrays were formerly called index-by-tables. In PL/SQL they are arrays of key-value pairs where the keys may be numeric or string types and the values may be any scalar type. The keys may be sparse. See the PL/SQL manual
The database only exports a limited form of this to the client where the keys must be numeric, positive and dense and the values can be only numeric or string. The lengths of the string data are limited to 32767 bytes. The number of characters depends on the character set used. See the PL/SQL manual. The JDBC-thin and JDBC-OCI drivers support 32767 bytes. The server side internal driver is limited to 16382 bytes for input.
- Parameters:
parameterIndex
- This argument indicates the parameter position within the statement. The first parameter is 1, the second is 2, ...arrayData
- This argument is an array of values to be bound to the PL/SQL index-by table parameter. The value is of type java.lang.Object, and the value can be a Java primitive type array such as int[] or a Java object array such as BigDecimal[].maxLen
- This argument specifies the maximum table length of the index-by table bind value which defines the maximum possible curLen for batch updates. For standalone binds, maxLen should use the same value as curLen. This argument is required.curLen
- This argument specifies the actual size of the index-by table bind value in arrayData. If the curLen value is smaller than the size of arrayData, only the curLen number of table elements is passed to the database. If the curLen value is larger than the size of arrayData, the entire arrayData is sent to the database.elemSqlType
- This argument specifies the index-by table element type based on the values defined in the OracleTypes class.elemMaxLen
- This argument specifies the index-table element maximum length in case the element type is CHAR, VARCHAR, or RAW. This value is ignored for other types. A value of 0 for elemMaxLen would indicate the driver to calculate the elemMaxLen based on the actual length of data bound. For a non zero value if the data bound is greater than elemMaxLen it is truncated.- Throws:
java.sql.SQLException
- if a database access error occurs- Since:
- 8.1.7
-
setFormOfUse
void setFormOfUse(int parameterIndex, short formOfUse)
Specifies if the data is bound for a SQL NCHAR datatype. It sets the "form of use" of a column of this prepared statement. There are two constants that specify the "form of use":FORM_CHAR
for SQL CHAR datatypes andFORM_NCHAR
for SQL NCHAR datatypes, whereFORM_CHAR
is the default. If the "form of use" is set toFORM_NCHAR
, the JDBC driver will represent the provided data in the national character set of the server.The usage of SQL NCHAR datatypes is similar to that of the SQL CHAR (
CHAR
,VARCHAR2
, andCLOB
) datatypes. JDBC uses the same classes and methods to access SQL NCHAR datatypes that are used for the corresponding SQL CHAR datatypes. Therefore, there are no separate, corresponding classes defined in theoracle.sql
package for SQL NCHAR datatypes. Likewise, there is no separate, corresponding constant defined in theoracle.jdbc.OracleTypes
class for SQL NCHAR datatypes. The only difference in usage between the two datatypes occur in a data bind situation: a JDBC program must call thesetFormOfUse()
method to specify if the data is bound for a SQL NCHAR datatype.In order to put this method in effect, you must invoke this method before
setXXX()
andregisterOutParameter()
for the column.The following code shows how to access SQL NCHAR data:
// // Table TEST has the following columns: // - NUMBER // - NVARCHAR2 // - NCHAR // oracle.jdbc.OraclePreparedStatement pstmt = (oracle.jdbc.OraclePreparedStatement) conn.prepareStatement("insert into TEST values(?, ?, ?)"); // oracle.jdbc.OraclePreparedStatement.FORM_NCHAR should be used for all NCHAR, // NVARCHAR2 and NCLOB data types. pstmt.setFormOfUse(2, FORM_NCHAR); pstmt.setFormOfUse(3, FORM_NCHAR); pstmt.setInt(1, 1); // NUMBER column pstmt.setString(2, myUnicodeString1); // NVARCHAR2 column pstmt.setString(3, myUnicodeString2); // NCHAR column pstmt.execute();
- Parameters:
parameterIndex
- index of the column in the preparedStatmentformOfUse
- use FORM_CHAR for CHAR, VARCHAR2 and CLOB data, or FORM_NCHAR for NCHAR, NVARCHAR2 and NCLOB data. FORM_CHAR is the default.- Since:
- 9i
-
setDisableStmtCaching
void setDisableStmtCaching(boolean cache)
Don't Cache this object even when the corresponding Connection is Cache Enabled.- Parameters:
cache
- Set it to true, if you don't want this statement to be cached.
-
OracleGetParameterMetaData
OracleParameterMetaData OracleGetParameterMetaData() throws java.sql.SQLException
Retrieves the number, types and properties of thisPreparedStatement
object's parameters.- Returns:
- an
OracleParameterMetaData
object that contains information about the number, types and properties of thisPreparedStatement
object's parameters - Throws:
java.sql.SQLException
- if a database access error occurs- Since:
- 9.0.2
- See Also:
OracleParameterMetaData
-
registerReturnParameter
void registerReturnParameter(int paramIndex, int externalType) throws java.sql.SQLException
Registers return parameter for DML Returning.- Parameters:
paramIndex
- Index of return parameter (should be > 0)externalType
- Type of return parameter.
For OracleTypes REF, STRUCT, JAVA_STRUCT, ARRAY, use:
registerReturnParameter(int paramIndex, int externalType, String typeName)
- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 10.2
-
registerReturnParameter
void registerReturnParameter(int paramIndex, int externalType, int maxSize) throws java.sql.SQLException
Registers return parameter for DML Returning. maxSize is the max bytes or chars of the return parameter, depending on the type of the return parameter. This method can be only used with char or raw types. If you don't know the max size of return parameters, you should use registerReturnParameter(int paramIndex, int externalType), which picks the default max size for you. If you know the max size of return parameters, using this method can reduce memory consumption.- Parameters:
paramIndex
- Index of return parameter (should be > 0)externalType
- Type of return parametermaxSize
- Max bytes or chars of return parameter- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 10.2
-
registerReturnParameter
void registerReturnParameter(int paramIndex, int externalType, java.lang.String typeName) throws java.sql.SQLException
Registers return parameter for DML Returning.- Parameters:
paramIndex
- Index of return parameter (should be > 0)externalType
- Type of return parametertypeName
- The fully-qualified name of an SQL structured type- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 10.2
-
getReturnResultSet
java.sql.ResultSet getReturnResultSet() throws java.sql.SQLException
Returns result set that contains data returned from DML Returning.- Throws:
java.sql.SQLException
- if an error occurs- Since:
- 10.2
-
setNCharacterStreamAtName
void setNCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader, long length) throws java.sql.SQLException
Sets the designated parameter to a Java CharacterStream value using the NCHAR character set.- Parameters:
parameterName
-reader
-length
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNCharacterStreamAtName
void setNCharacterStreamAtName(java.lang.String parameterName, java.io.Reader reader) throws java.sql.SQLException
Sets the designated parameter to a Java CharacterStream value using the NCHAR character set.- Parameters:
parameterName
-reader
-- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNClobAtName
void setNClobAtName(java.lang.String parameterName, java.sql.NClob value) throws java.sql.SQLException
Sets the designated parameter to ajava.sql.NClob
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNClobAtName
void setNClobAtName(java.lang.String parameterName, java.io.Reader reader, long length) throws java.sql.SQLException
Sets the designated parameter to ajava.sql.NClob
value.- Parameters:
parameterName
-reader
- the Reader from which to get the valuelength
- the number of characters to read- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNClobAtName
void setNClobAtName(java.lang.String parameterName, java.io.Reader reader) throws java.sql.SQLException
Sets the designated parameter to ajava.sql.NClob
value.- Parameters:
parameterName
-reader
- the Reader from which to get the value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setNStringAtName
void setNStringAtName(java.lang.String parameterName, java.lang.String value) throws java.sql.SQLException
Sets the designated parameter to ajava.sql.String
value using the NCHAR character set- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setRowIdAtName
void setRowIdAtName(java.lang.String parameterName, java.sql.RowId value) throws java.sql.SQLException
Sets the designated parameter to ajava.sql.RowId
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
setSQLXMLAtName
void setSQLXMLAtName(java.lang.String parameterName, java.sql.SQLXML value) throws java.sql.SQLException
Sets the designated parameter to ajava.sql.SQLXML
value.- Parameters:
parameterName
-value
- the parameter value- Throws:
java.sql.SQLException
- if a database access error occurs
-
executeQueryAsyncOracle
java.util.concurrent.Flow.Publisher<OracleResultSet> executeQueryAsyncOracle() throws java.sql.SQLException
Executes the SQL query in this
PreparedStatement
object asynchronously and returns aPublisher
which publishes a singleResultSet
containing the rows produced.If the query produces an error or if the query does not produce a set of rows, the
Publisher
callsonError
with aSQLException
corresponding to the error.The returned
Publisher
callsonError
with aSQLTimeoutException
when the driver has determined that the timeout value that was specified by thesetQueryTimeout
method has been exceeded and has at least attempted to cancel the currently runningStatement
. It callsonError
withSQLException
if a database access error occurs.Calling any method of this
PreparedStatement
exceptcancel
,isClosed
, or one defined byObject
after this method is called will block until the returnedPublisher
callsonComplete
oronError
.Oracle JDBC implements this
OracleCommonPreparedStatement
method to publish an instance ofOracleResultSet
.- Specified by:
executeQueryAsyncOracle
in interfaceOracleCommonPreparedStatement
- Returns:
- a
Publisher
of theResultSet
- Throws:
java.sql.SQLException
- if a database access error occurs; this method is called on a closedPreparedStatement
or the implementation detects that the SQL statement does not return aResultSet
object
-
executeUpdateAndSuspend
int executeUpdateAndSuspend() throws java.sql.SQLException
Executes the SQL statement in thisPreparedStatement
object, which must be an SQL Data Manipulation Language (DML) statement, such asINSERT
,UPDATE
orDELETE
; or an SQL statement that returns nothing, such as a DDL statement. Then suspends any active sessionless transaction in the current session. This offers an alternative to separately callingPreparedStatement.executeUpdate()
followed byOracleConnection.suspendTransactionImmediately()
, allowing them to be combined into a single round-trip. If either the executeUpdate or suspend operations throws an exception, both operations fail. If no transaction is active the suspend operation is a no-op.- Returns:
- either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing.
- Throws:
java.sql.SQLException
-
-