oracle.jdbc.driver
Class OraclePreparedStatement

oracle.jdbc.driver.OraclePreparedStatement

public class OraclePreparedStatement

Oracle prepared statement class.


Method Summary
 void addBatch()
          Add a set of parameters to the batch.
 void addBatch(java.lang.String sql)
          This method cannot be used in OraclePreparedStatement.
 void clearBatch()
          Make the set of parameters in the current batch empty.
 void clearParameters()
          In general, parameter values remain in force for repeated use of a Statement.
 void close()
          Close the prepared statement.
 void closeWithKey(java.lang.String key)
          The underlying cursor is not closed and the Statement handle is cached on the Key.
 void defineParameterType(int param_index, int type, int max_size)
          Define the type under which you will bind the parameter and the maximum size of data you will bind in binds.
 boolean execute()
          Execute the statement.
 int[] executeBatch()
          Submit a batch of parameters to the database for execution.
 java.sql.ResultSet executeQuery()
          Execute the query statement.
 int executeUpdate()
          Execute the update statement.
 int getExecuteBatch()
          Retrieve the batch value (for Oracle-style batching only).
 java.sql.ResultSetMetaData getMetaData()
          JDBC 2.0 Gets the number, types and properties of a ResultSet's columns.
 int sendBatch()
          Send any existing Oracle-style batch.
 void setArray(int paramIndex, java.sql.Array arr)
          JDBC 2.0.
 void setARRAY(int paramIndex, ARRAY arr)
          Oracle specific.
 void setAsciiStream(int paramIndex, java.io.InputStream istream, int length)
          Sets the designated parameter to the given input stream, which will have the specified number of bytes.
 void setBfile(int paramIndex, BFILE file)
          Oracle specific.
 void setBFILE(int paramIndex, BFILE file)
          Oracle specific.
 void setBigDecimal(int paramIndex, java.math.BigDecimal x)
          Sets the designated parameter to a java.lang.BigDecimal value.
 void setBinaryStream(int paramIndex, java.io.InputStream istream, int length)
          Sets the designated parameter to the given input stream, which will have the specified number of bytes.
 void setBlob(int paramIndex, java.sql.Blob lob)
          JDBC 2.0.
 void setBLOB(int paramIndex, BLOB lob)
          Oracle specific.
 void setBoolean(int paramIndex, boolean x)
          Sets the designated parameter to a Java boolean value.
 void setByte(int paramIndex, byte x)
          Sets the designated parameter to a Java byte value.
 void setBytes(int paramIndex, byte[] x)
          Sets the designated parameter to a Java array of bytes.
 void setCHAR(int paramIndex, CHAR ch)
          Oracle specific.
 void setCharacterStream(int paramIndex, java.io.Reader reader, int length)
          JDBC 2.0 Sets the designated parameter to the given Reader object, which is the given number of characters long.
 void setClob(int paramIndex, java.sql.Clob lob)
          JDBC 2.0.
 void setCLOB(int paramIndex, CLOB lob)
          Oracle specific.
 void setCursor(int paramIndex, java.sql.ResultSet rs)
          Oracle specific.
 void setCustomDatum(int paramIndex, CustomDatum x)
          Deprecated.  
 void setDate(int paramIndex, java.sql.Date x)
          Sets the designated parameter to a java.sql.Date value.
 void setDATE(int paramIndex, DATE date)
          Oracle specific.
 void setDate(int paramIndex, java.sql.Date x, java.util.Calendar cal)
          JDBC 2.0 Sets the designated parameter to a java.sql.Date value, using the given Calendar object.
 void setDisableStmtCaching(boolean cache)
          Don't Cache this object even when the corresponding Connection is Cache Enabled.
 void setDouble(int paramIndex, double x)
          Sets the designated parameter to a Java double value.
 void setExecuteBatch(int batchValue)
          Set the batch value (for Oracle-style batching only).
 void setFixedCHAR(int paramIndex, java.lang.String x)
          Use this method when binding to a CHAR column in the where clause of a Select statement.
 void setFloat(int paramIndex, float x)
          Sets the designated parameter to a Java float value.
 void setFormOfUse(int paramIndex, short formOfUse)
          Sets the "Form Of Use".
 void setInt(int paramIndex, int x)
          Sets the designated parameter to a Java int value.
 void setLong(int paramIndex, long x)
          Sets the designated parameter to a Java long value.
 void setNull(int paramIndex, int sqlType)
          Sets the designated parameter to SQL NULL.
 void setNull(int paramIndex, int sqlType, java.lang.String sqlName)
          Implements JDBC 2.0 setNull for object types.
 void setNUMBER(int paramIndex, NUMBER num)
          Oracle specific.
 void setObject(int paramIndex, java.lang.Object x)
          Sets the value of the designated parameter with the given object.
 void setObject(int paramIndex, java.lang.Object x, int targetSqlType)
          Sets the value of the designated parameter with the given object.
 void setObject(int paramIndex, java.lang.Object x, int targetSqlType, int scale)
          Sets the value of a parameter using an object.
 void setOPAQUE(int paramIndex, OPAQUE opaque)
          Oracle specific.
 void setOracleObject(int paramIndex, Datum x)
          Oracle specific.
 void setORAData(int paramIndex, ORAData x)
          Set the designated parameter to an oracle.sql.ORAData value.
 void setPlsqlIndexTable(int paramIndex, java.lang.Object arrayData, int maxLen, int curLen, int elemSqlType, int elemMaxLen)
          Oracle OCI driver specific.
 void setPreBindsCompelete()
           
 void setRAW(int paramIndex, RAW raw)
          Oracle specific.
 void setRef(int paramIndex, java.sql.Ref ref)
          JDBC 2.0 Sets a Ref(<structured-type>) parameter.
 void setREF(int paramIndex, REF ref)
          Oracle specific.
 void setRefType(int paramIndex, REF ref)
          Oracle specific.
 void setROWID(int paramIndex, ROWID rowid)
          Oracle specific.
 void setShort(int paramIndex, short x)
          Sets the designated parameter to a Java short value.
 void setString(int paramIndex, java.lang.String x)
          Sets the designated parameter to a Java String value.
 void setSTRUCT(int paramIndex, STRUCT struct)
          Oracle specific.
 void setStructDescriptor(int paramIndex, StructDescriptor desc)
          Oracle specific.
 void setTime(int paramIndex, java.sql.Time x)
          Sets the designated parameter to a java.sql.Time value.
 void setTime(int paramIndex, java.sql.Time x, java.util.Calendar cal)
          JDBC 2.0 Sets the designated parameter to a java.sql.Time value, using the given Calendar object.
 void setTimestamp(int paramIndex, java.sql.Timestamp x)
          Sets the designated parameter to a java.sql.Timestamp value.
 void setTIMESTAMP(int paramIdx, TIMESTAMP x)
          Sets the designated parameter to an oracle.sql.TIMESTAMP value.
 void setTimestamp(int paramIndex, java.sql.Timestamp x, java.util.Calendar cal)
          JDBC 2.0 Sets the designated parameter to a java.sql.Timestamp value, using the given Calendar object.
 void setTIMESTAMPLTZ(int paramIdx, TIMESTAMPLTZ x)
          Sets the designated parameter to an oracle.sql.TIMESTAMPLTZ value.
 void setTIMESTAMPTZ(int paramIdx, TIMESTAMPTZ x)
          Sets the designated parameter to an oracle.sql.TIMESTAMPTZ value.
 void setUnicodeStream(int paramIndex, java.io.InputStream istream, int length)
          Deprecated.  
 

Method Detail

close

public void close()
           throws java.sql.SQLException
Close the prepared statement.
Throws:
java.sql.SQLException - if error(s) occurred.

closeWithKey

public void closeWithKey(java.lang.String key)
                  throws java.sql.SQLException
The underlying cursor is not closed and the Statement handle is cached on the Key. The Statement is cached as it is and the state, data, and meta-data is not cleared. The same statement can be retrieved with this Key later.
Parameters:
key - A key to tag to the statement to be retrieved later
Throws:
java.sql.SQLException - if a database access error occurs

executeQuery

public java.sql.ResultSet executeQuery()
                                throws java.sql.SQLException
Execute the query statement.
Returns:
the query result set.
Throws:
java.sql.SQLException - if error(s) occurred.

executeUpdate

public int executeUpdate()
                  throws java.sql.SQLException
Execute the update statement.
Throws:
java.sql.SQLException - if error(s) occurred.

execute

public boolean execute()
                throws java.sql.SQLException
Execute the statement.
Throws:
java.sql.SQLException - if error(s) occurred.

sendBatch

public int sendBatch()
              throws java.sql.SQLException
Send any existing Oracle-style batch.

This API is used in the context of Oracle-style batching. It flushes any batched executions before the batch value is reached. Executions normally happen when the number of executions reaches the batch value, which is set via the API setExecuteBatch(). It does not do anything if the statement does not use Oracle-style batching.

To use this API, the user must cast the PreparedStatement object to oracle.jdbc.driver.OraclePreparedStatement.

Returns:
the update count.
Throws:
java.sql.SQLException - if an error occurred.

setExecuteBatch

public void setExecuteBatch(int batchValue)
                     throws java.sql.SQLException
Set the batch value (for Oracle-style batching only).

The Oracle Jdbc driver can "batch" multiple executions of a single statement with different bind variables. Actual execution happens when the number of batched executions reaches the "batch value", which is set by this API.

The batch value for this prepared statement can be set at any time via this API. Changing the batch value will affect all future executes.

The batch value will automatically be set to 1 by the driver if any of the bind types is of type stream. This overrides any value that the user might have set. Binds that were performed before any setXXXStream() is called, and that have not been executed, will be flushed (i.e. executed).

To use this API, the user must cast the PreparedStatement object to oracle.jdbc.driver.OraclePreparedStatement.

Parameters:
batchValue - batch value to be set. It must be greater than or equal to 1.

getExecuteBatch

public final int getExecuteBatch()
Retrieve the batch value (for Oracle-style batching only).
Returns:
the batch value last set by setExecuteBatch().

defineParameterType

public 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 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 the setXXX 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 Types.CHAR as the type value if you are going bind later as setCHAR and use Types.VARCHAR if you are going to bind as setString for effective results. Also, you cannot use this for LONG types.

Parameters:
param_index - Index of bind parameter.
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.

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                       throws java.sql.SQLException
JDBC 2.0 Gets the number, types and properties of a ResultSet's columns.
Returns:
the description of a ResultSet's columns
Throws:
java.sql.SQLException - if a database access error occurs

setNull

public void setNull(int paramIndex,
                    int sqlType,
                    java.lang.String sqlName)
             throws java.sql.SQLException
Implements JDBC 2.0 setNull for object types. Sets the designated parameter to SQL NULL. This version of setNull should be used for STRUCT, ARRAY and REF type parameters.

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-named 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. Although it is intended for user-named 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-named or REF type, the given typeName is ignored.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
sqlType - a value from java.sql.Types
typeName - the fully-qualified name of an SQL user-named type, ignored if the parameter is not a user-named type or REF
Throws:
java.sql.SQLException - if a database access error occurs

setNull

public void setNull(int paramIndex,
                    int sqlType)
             throws java.sql.SQLException
Sets the designated parameter to SQL NULL. This method can't be used for STRUCT, REF and ARRAY type parameters.

Note: You must specify the parameter's SQL type.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
sqlType - the SQL type code defined in java.sql.Types
Throws:
java.sql.SQLException - if a database access error occurs

setBoolean

public void setBoolean(int paramIndex,
                       boolean x)
                throws java.sql.SQLException
Sets the designated parameter to a Java boolean value.
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

setByte

public void setByte(int paramIndex,
                    byte x)
             throws java.sql.SQLException
Sets the designated parameter to a Java byte value.
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

setShort

public void setShort(int paramIndex,
                     short x)
              throws java.sql.SQLException
Sets the designated parameter to a Java short value.
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

setInt

public void setInt(int paramIndex,
                   int x)
            throws java.sql.SQLException
Sets the designated parameter to a Java int value.
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

setLong

public void setLong(int paramIndex,
                    long x)
             throws java.sql.SQLException
Sets the designated parameter to a Java long value.
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

setFloat

public void setFloat(int paramIndex,
                     float x)
              throws java.sql.SQLException
Sets the designated parameter to a Java float value.
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

setDouble

public void setDouble(int paramIndex,
                      double x)
               throws java.sql.SQLException
Sets the designated parameter to a Java double value.
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

setBigDecimal

public void setBigDecimal(int paramIndex,
                          java.math.BigDecimal x)
                   throws java.sql.SQLException
Sets the designated parameter to a java.lang.BigDecimal value.
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

setString

public void setString(int paramIndex,
                      java.lang.String x)
               throws java.sql.SQLException
Sets the designated parameter to a Java String value.
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

setFixedCHAR

public void setFixedCHAR(int paramIndex,
                         java.lang.String x)
                  throws java.sql.SQLException
Use this method when binding to a CHAR column in the where clause of a Select statement. A non padded comparision will be done unlike in setCHAR and setString case. Not particularly needed for an insert as the database will pad it.

Parameters:
paramIndex - index of the bind variable
x - the literal/variable to be bound.
Throws:
java.sql.SQLException - error while binding

setCursor

public void setCursor(int paramIndex,
                      java.sql.ResultSet rs)
               throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a java.sql.ResultSet. This is used for RefCursor parameter only.
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

setROWID

public void setROWID(int paramIndex,
                     ROWID rowid)
              throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.RAW.
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

setArray

public void setArray(int paramIndex,
                     java.sql.Array arr)
              throws java.sql.SQLException
JDBC 2.0. Sets the designated parameter to a Array value.
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

setARRAY

public void setARRAY(int paramIndex,
                     ARRAY arr)
              throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.ARRAY.
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

setOPAQUE

public void setOPAQUE(int paramIndex,
                      OPAQUE opaque)
               throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.STRUCT.
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

public void setStructDescriptor(int paramIndex,
                                StructDescriptor desc)
                         throws java.sql.SQLException
Oracle specific. Sets the bind type of designated parameter from an oracle.sql.StructDescriptor.
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

setPreBindsCompelete

public void setPreBindsCompelete()
                          throws java.sql.SQLException

setSTRUCT

public void setSTRUCT(int paramIndex,
                      STRUCT struct)
               throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.STRUCT.
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

setRAW

public void setRAW(int paramIndex,
                   RAW raw)
            throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.RAW.
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

setCHAR

public void setCHAR(int paramIndex,
                    CHAR ch)
             throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.CHAR.
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

setDATE

public void setDATE(int paramIndex,
                    DATE date)
             throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.DATE.
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

setNUMBER

public void setNUMBER(int paramIndex,
                      NUMBER num)
               throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.NUMBER.
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

setBLOB

public void setBLOB(int paramIndex,
                    BLOB lob)
             throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.BLOB.
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

setBlob

public void setBlob(int paramIndex,
                    java.sql.Blob lob)
             throws java.sql.SQLException
JDBC 2.0. Sets the designated parameter to a Blob value.
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

setCLOB

public void setCLOB(int paramIndex,
                    CLOB lob)
             throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.CLOB.
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

setClob

public void setClob(int paramIndex,
                    java.sql.Clob lob)
             throws java.sql.SQLException
JDBC 2.0. Sets the designated parameter to a Clob value.
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

setBFILE

public void setBFILE(int paramIndex,
                     BFILE file)
              throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.BFILE value.
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

setBfile

public void setBfile(int paramIndex,
                     BFILE file)
              throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.BFILE value.
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

setBytes

public void setBytes(int paramIndex,
                     byte[] x)
              throws java.sql.SQLException
Sets the designated parameter to a Java array of bytes.
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

setDate

public void setDate(int paramIndex,
                    java.sql.Date x)
             throws java.sql.SQLException
Sets the designated parameter to a java.sql.Date value.
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

setTime

public void setTime(int paramIndex,
                    java.sql.Time x)
             throws java.sql.SQLException
Sets the designated parameter to a java.sql.Time value.
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

setTimestamp

public void setTimestamp(int paramIndex,
                         java.sql.Timestamp x)
                  throws java.sql.SQLException
Sets the designated parameter to a java.sql.Timestamp value.
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

setTIMESTAMP

public void setTIMESTAMP(int paramIdx,
                         TIMESTAMP x)
                  throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.TIMESTAMP value.
Parameters:
paramIdx - specifies the parameter index. Index starts from 1.
x - specifies the parameter value.
Throws:
java.sql.SQLException - if an error occurred.
Since:
9i

setTIMESTAMPTZ

public void setTIMESTAMPTZ(int paramIdx,
                           TIMESTAMPTZ x)
                    throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.TIMESTAMPTZ value.
Parameters:
paramIdx - specifies the parameter index. Index starts from 1.
x - specifies the parameter value.
Throws:
java.sql.SQLException - if an error occurred.
Since:
9i

setTIMESTAMPLTZ

public void setTIMESTAMPLTZ(int paramIdx,
                            TIMESTAMPLTZ x)
                     throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.TIMESTAMPLTZ value.

In order to use this method, the calling program must first invoke OracleConnection.setSessionTimeZone() to set the session time zone.

Parameters:
paramIdx - specifies the parameter index. Index starts from 1.
x - specifies the parameter value.
Throws:
java.sql.SQLException - if an error occurred.
Since:
9i

setAsciiStream

public void setAsciiStream(int paramIndex,
                           java.io.InputStream istream,
                           int length)
                    throws java.sql.SQLException
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to a LONG parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from ASCII to the database char format.

Note: There are restrictions to use this method for CLOBs. Please see details in Oracle JDBC documents or Readme to avoid data lossage.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
istream - the Java input stream that contains the ASCII parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryStream

public void setBinaryStream(int paramIndex,
                            java.io.InputStream istream,
                            int length)
                     throws java.sql.SQLException
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large binary value is input to a LONG RAW parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file.

Note: There are restrictions to use this method for BLOBs. Please see details in Oracle JDBC documents or Readme to avoid data lossage.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the binary parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - if a database access error occurs

setUnicodeStream

public void setUnicodeStream(int paramIndex,
                             java.io.InputStream istream,
                             int length)
                      throws java.sql.SQLException
Deprecated.  
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large UNICODE value is input to a LONG parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format. The byte format of the Unicode stream is the 2 bytes UCS-2 encoding.

Note: There are restrictions to use this method for CLOBs. Please see details in Oracle JDBC documents or Readme to avoid data lossage.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java input stream which contains the UNICODE parameter value
length - the number of bytes in the stream
Throws:
java.sql.SQLException - if a database access error occurs

setCustomDatum

public void setCustomDatum(int paramIndex,
                           CustomDatum x)
                    throws java.sql.SQLException
Deprecated.  
Set the designated parameter to a oracle.sql.CustomDatum value.

This method is deprecated. It is recommended to use setORAData().

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

setORAData

public void setORAData(int paramIndex,
                       ORAData x)
                throws java.sql.SQLException
Set the designated parameter to an oracle.sql.ORAData value.

This is an Oracle specific method.

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

setObject

public void setObject(int paramIndex,
                      java.lang.Object x,
                      int targetSqlType,
                      int scale)
               throws java.sql.SQLException

Sets the value of a parameter using an object. The second argument must be an object type.

The given Java object will be converted to the targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing SQLData), the JDBC driver should call its method writeSQL to write it to the SQL data stream.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the object containing the input parameter value
targetSqlType - the SQL type (as defined in java.sql.Types or OracleTypes) to be sent to the database.
scale - for numeric types. Ignored for other types.
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
Types

setObject

public void setObject(int paramIndex,
                      java.lang.Object x,
                      int targetSqlType)
               throws java.sql.SQLException
Sets the value of the designated parameter with the given object. This method is like setObject above, except that it assumes a scale of zero.
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the object containing the input parameter value
targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to the database
Throws:
java.sql.SQLException - if a database access error occurs

setRefType

public void setRefType(int paramIndex,
                       REF ref)
                throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.REF value.
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

setRef

public void setRef(int paramIndex,
                   java.sql.Ref ref)
            throws java.sql.SQLException
JDBC 2.0 Sets a Ref(<structured-type>) parameter.
Parameters:
i - the first parameter is 1, the second is 2, ...
x - an object representing data of an SQL REF Type
Throws:
java.sql.SQLException - if a database access error occurs

setREF

public void setREF(int paramIndex,
                   REF ref)
            throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.REF value.
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

setObject

public void setObject(int paramIndex,
                      java.lang.Object x)
               throws java.sql.SQLException
Sets the value of the designated parameter with the given object. This method is like setObject above, except that it finds out the SQL type base on the given object's type.
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the object containing the input parameter value
targetSqlType - the SQL type (as defined in java.sql.Types) to be sent to the database
Throws:
java.sql.SQLException - if a database access error occurs

setOracleObject

public void setOracleObject(int paramIndex,
                            Datum x)
                     throws java.sql.SQLException
Oracle specific. Sets the designated parameter to a oracle.sql.Datum value.
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

setPlsqlIndexTable

public void setPlsqlIndexTable(int paramIndex,
                               java.lang.Object arrayData,
                               int maxLen,
                               int curLen,
                               int elemSqlType,
                               int elemMaxLen)
                        throws java.sql.SQLException
Oracle OCI driver specific. Sets the designated PLSQL index table parameter.
Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
arrayData - a java array
maxLen - the maximum possible number of elements.
curLen - the current number of elements
elemSqlType - 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.
Throws:
java.sql.SQLException - if a database access error occurs
Since:
8.1.7

clearParameters

public void clearParameters()
                     throws java.sql.SQLException

In general, parameter values remain in force for repeated use of a Statement. Setting a parameter value automatically clears its previous value. However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters.


setCharacterStream

public void setCharacterStream(int paramIndex,
                               java.io.Reader reader,
                               int length)
                        throws java.sql.SQLException
JDBC 2.0 Sets the designated parameter to the given Reader object, which is the given number of characters long. When a very large UNICODE value is input to a LONG parameter, it may be more practical to send it via a java.io.Reader. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

Note: There are restrictions to use this method to access CLOBs in database. To avoid data lossage, please read Oracle JDBC documents or Reademe for details.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the java reader which contains the UNICODE data
length - the number of characters in the stream
Throws:
java.sql.SQLException - if a database access error occurs

setDate

public void setDate(int paramIndex,
                    java.sql.Date x,
                    java.util.Calendar cal)
             throws java.sql.SQLException
JDBC 2.0 Sets the designated parameter to a java.sql.Date value, using the given Calendar object. Since Oracle database doesn't support timezone for DATE. This method set the same value as setDate(idx, x).

setTime

public void setTime(int paramIndex,
                    java.sql.Time x,
                    java.util.Calendar cal)
             throws java.sql.SQLException
JDBC 2.0 Sets the designated parameter to a java.sql.Time value, using the given Calendar object. Since Oracle database doesn't support timezone for DATE. This method set the same value as setTime(idx, x).

setTimestamp

public void setTimestamp(int paramIndex,
                         java.sql.Timestamp x,
                         java.util.Calendar cal)
                  throws java.sql.SQLException
JDBC 2.0 Sets the designated parameter to a java.sql.Timestamp value, using the given Calendar object. Since Oracle database doesn't support timezone for DATE. This method set the same value as setTimestamp(idx, x).

addBatch

public void addBatch()
              throws java.sql.SQLException
Add a set of parameters to the batch.
Throws:
java.sql.SQLException - if an error occurred.
Since:
8.1.6 (JDBC 2.0).

addBatch

public void addBatch(java.lang.String sql)
              throws java.sql.SQLException
This method cannot be used in OraclePreparedStatement.

clearBatch

public void clearBatch()
                throws java.sql.SQLException
Make the set of parameters in the current batch empty.
Throws:
java.sql.SQLException - if a database access error occurred. This can be used for clear both Jdbc & Oracle type batching.
Since:
81.6 (JDBC 2.0).

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
Submit a batch of parameters to the database for execution.

Commands are executed in the order in which they were added to the batch. This method closes the calling Statement object's current set if one is open. The statement's internal list of batch commands is reset to empty once this method returns.

Returns:
an array containing one entry per each element in the batch. Each value is always -2.
Throws:
java.sql.BatchUpdateException - if any of the commands in the batch failed to execute properly. (For example, the batch will fail if it contained a command that returns a result set.)
Since:
8.1.6 (JDBC 2.0).

setDisableStmtCaching

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

setFormOfUse

public void setFormOfUse(int paramIndex,
                         short formOfUse)
Sets the "Form Of Use". See the javadoc in the interface.