Oracle10g JDBC

oracle.jdbc
Interface OraclePreparedStatement

All Superinterfaces:
OracleStatement, java.sql.PreparedStatement, java.sql.Statement
All Known Subinterfaces:
OracleCallableStatement

public interface OraclePreparedStatement
extends java.sql.PreparedStatement, OracleStatement

This interface defines the Oracle extensions to the standard JDBC interface java.sql.PreparedStatement. You can use java.sql.PreparedStatement in your application where you do not make use of the Oracle extensions. However, when your application uses the Oracle extensions to java.sql.PreparedStatement you must cast your prepared statement object to the type oracle.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 binding oracle.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 or UPDATE operations, you will typically create a PreparedStatement object. This allows you to execute a statement with varying sets of input parameters. The prepareStatement() method of your JDBC Connection object allows you to define a statement that takes variable bind parameters, and returns a JDBC PreparedStatement object with your statement definition.

Bind your data : Use setXXX() methods on the PreparedStatement 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 your PreparedStatement object to the OraclePreparedStatement type.

For example, if you have a Connection object named conn and a RAW named my_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
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 java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Fields inherited from interface oracle.jdbc.OracleStatement
EXPLICIT, IMPLICIT, NEW
 
Method Summary
 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.
 int getExecuteBatch()
          Retrieves the batch value of this statement for the Oracle update batching model (default is set by the connection object).
 OracleParameterMetaData OracleGetParameterMetaData()
          Retrieves the number, types and properties of this PreparedStatement object's parameters.
 int sendBatch()
          Sends any existing batch (for the Oracle update batching model).
 void setARRAY(int paramIndex, ARRAY arr)
          Binds the designated parameter to a oracle.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 a oracle.sql.ARRAY value.
 void setAsciiStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length)
          Sets the designated parameter to a Java AsciiStream value.
 void setBfile(int paramIndex, BFILE file)
          Binds the designated parameter to a oracle.sql.BFILE value.
 void setBFILE(int paramIndex, BFILE file)
          Binds the designated parameter to a oracle.sql.BFILE value.
 void setBfileAtName(java.lang.String parameterName, BFILE value)
          Sets the designated parameter to a oracle.sql.BFILEvalue.
 void setBFILEAtName(java.lang.String parameterName, BFILE value)
          Sets the designated parameter to a oracle.sql.BFILEvalue.
 void setBigDecimalAtName(java.lang.String parameterName, java.math.BigDecimal value)
          Sets the designated parameter to a Java BigDecimal value.
 void setBinaryDouble(int paramIndex, BINARY_DOUBLE value)
          Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value.
 void setBinaryDouble(int paramIndex, 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 setBinaryDoubleAtName(java.lang.String parameterName, double value)
          Sets the designated parameter to a Java Double value.
 void setBinaryFloat(int paramIndex, BINARY_FLOAT value)
          Sets the designated parameter to an oracle.sql.BINARY_FLOAT value.
 void setBinaryFloat(int paramIndex, 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 setBinaryFloatAtName(java.lang.String parameterName, float value)
          Sets the designated parameter to a Java Float value.
 void setBinaryStreamAtName(java.lang.String parameterName, java.io.InputStream stream, int length)
          Sets the designated parameter to a Java BinaryStream value.
 void setBLOB(int paramIndex, BLOB lob)
          Binds the designated parameter to a oracle.sql.BLOB 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 setCHAR(int paramIndex, CHAR ch)
          Binds the designated parameter to a oracle.sql.CHAR 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 paramIndex, CLOB lob)
          Binds the designated parameter to a oracle.sql.CLOB 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 paramIndex, 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 paramIndex, CustomDatum x)
          Deprecated.  
 void setCustomDatumAtName(java.lang.String parameterName, CustomDatum value)
          Sets the designated parameter to a Java CustomDatum value.
 void setDATE(int paramIndex, DATE date)
          Binds the designated parameter to a oracle.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, 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.
 void setExecuteBatch(int batchValue)
          Sets the batch value of this statement for the Oracle update batching model (the default value is set by the connection object).
 void setFixedCHAR(int paramIndex, java.lang.String x)
          Sets the disignated parameter to a String 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 paramIndex, 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 paramIndex, 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 paramIndex, 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 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 paramIndex, NUMBER num)
          Binds the designated parameter to a oracle.sql.NUMBER value.
 void setNUMBERAtName(java.lang.String parameterName, NUMBER value)
          Sets the designated parameter to an oracle.sql.NUMBERvalue.
 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 paramIndex, OPAQUE val)
          Binds the designated parameter to a oracle.sql.OPAQUE value.
 void setOPAQUEAtName(java.lang.String parameterName, OPAQUE value)
          Sets the designated parameter to an oracle.sql.OPAQUEvalue.
 void setOracleObject(int paramIndex, Datum x)
          Binds the designated parameter to a oracle.sql.Datum value.
 void setOracleObjectAtName(java.lang.String parameterName, Datum value)
          Sets the designated parameter to an oracle.sql.Datumvalue.
 void setORAData(int paramIndex, ORAData x)
          Binds the designated parameter to a oracle.sql.ORAData value.
 void setORADataAtName(java.lang.String parameterName, ORAData value)
          Sets the designated parameter to an oracle.sql.ORADatavalue.
 void setPlsqlIndexTable(int paramIndex, java.lang.Object arrayData, int maxLen, int curLen, int elemSqlType, int elemMaxLen)
          Binds a PL/SQL index-by table parameter in the IN parameter mode.
 void setRAW(int paramIndex, RAW raw)
          Binds the designated parameter to a oracle.sql.RAW value.
 void setRAWAtName(java.lang.String parameterName, RAW value)
          Sets the designated parameter to an oracle.sql.RAWvalue.
 void setREF(int paramIndex, REF ref)
          Binds the designated parameter to a oracle.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 an oracle.sql.REFvalue.
 void setRefType(int paramIndex, REF ref)
          Binds the designated parameter to a oracle.sql.REF value.
 void setRefTypeAtName(java.lang.String parameterName, REF value)
          Sets the designated parameter to an oracle.sql.REFvalue.
 void setROWID(int paramIndex, ROWID rowid)
          Binds the designated parameter to a oracle.sql.ROWID value.
 void setROWIDAtName(java.lang.String parameterName, ROWID value)
          Sets the designated parameter to an oracle.sql.ROWIDvalue.
 void setShortAtName(java.lang.String parameterName, short value)
          Sets the designated parameter to a Java Short value.
 void setStringAtName(java.lang.String parameterName, java.lang.String value)
          Sets the designated parameter to a Java String value.
 void setStringForClob(int paramIndex, 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 paramIndex, STRUCT struct)
          Binds the designated parameter to a oracle.sql.STRUCT value.
 void setSTRUCTAtName(java.lang.String parameterName, STRUCT value)
          Sets the designated parameter to an oracle.sql.STRUCTvalue.
 void setStructDescriptor(int paramIndex, 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 an oracle.sql.StructDescriptor value.
 void setTimeAtName(java.lang.String parameterName, java.sql.Time value)
          Sets the designated parameter to a Java Time value.
 void setTIMESTAMP(int paramIndex, 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, TIMESTAMP value)
          Sets the designated parameter to an oracle.sql.TIMESTAMP value.
 void setTIMESTAMPLTZ(int paramIndex, TIMESTAMPLTZ x)
          Binds the designated parameter to an oracle.sql.TIMESTAMPLTZ value.
 void setTIMESTAMPLTZAtName(java.lang.String parameterName, TIMESTAMPLTZ value)
          Sets the designated parameter to an oracle.sql.TIMESTAMPLTZ value.
 void setTIMESTAMPTZ(int paramIndex, TIMESTAMPTZ x)
          Binds the designated parameter to an oracle.sql.TIMESTAMPTZ value.
 void setTIMESTAMPTZAtName(java.lang.String parameterName, TIMESTAMPTZ value)
          Sets the designated parameter to an oracle.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 java.sql.PreparedStatement
addBatch, clearParameters, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setBigDecimal, setBinaryStream, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNull, setNull, setObject, setObject, setObject, setRef, setShort, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 
Methods inherited from interface oracle.jdbc.OracleStatement
clearDefines, closeWithKey, creationState, defineColumnType, defineColumnType, defineColumnType, defineColumnType, defineColumnTypeBytes, defineColumnTypeChars, getRowPrefetch, isNCHAR, setResultSetCache, setRowPrefetch
 

Field Detail

FORM_NCHAR

public 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 to setFormOfUse().

See Also:
Constant Field Values

FORM_CHAR

public 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 to setFormOfUse().

See Also:
Constant Field Values
Method Detail

defineParameterTypeBytes

public 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 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 OracleTypes.CHAR as the type value if you are going bind later as setCHAR and use OracleTypes.VARCHAR if you are going to bind as setString 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

public 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 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 OracleTypes.CHAR as the type value if you are going bind later as setCHAR and use OracleTypes.VARCHAR if you are going to bind as setString 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

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

Throws:
java.sql.SQLException

getExecuteBatch

public int getExecuteBatch()
Retrieves the batch value of this statement for the Oracle update batching model (default is set by the connection object).

To set the batch value for this statement, you can use the setExecuteBatch method. You can also set a default batch value with the OracleConnection.setDefaultExecuteBatch.

Returns:
the batch value
See Also:
OracleConnection.setDefaultExecuteBatch, setExecuteBatch

sendBatch

public int sendBatch()
              throws java.sql.SQLException
Sends any existing batch (for the Oracle update batching model).

This method 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 setExecuteBatch method. It does not do anything if the statement does not use the Oracle batching model.

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

setARRAY

public void setARRAY(int paramIndex,
                     ARRAY arr)
              throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.ARRAY.

Parameters:
arr - 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
Binds the designated parameter to a oracle.sql.BFILE value.

Note: This is the same as setBFILE.

Parameters:
file - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
setBFILE

setBFILE

public void setBFILE(int paramIndex,
                     BFILE file)
              throws java.sql.SQLException
Binds the designated parameter to a oracle.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 object ops 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 valid oracle.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 the BFILE class to get more details about how to deal with the data.

Parameters:
file - 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
Binds the designated parameter to a oracle.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 object ops and a BLOB named my_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 method BLOB.getBinaryOutputStream to write data to a BLOB.

Parameters:
lob - 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
Binds the designated parameter to a oracle.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:
ch - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
setFixedChar

setCLOB

public void setCLOB(int paramIndex,
                    CLOB lob)
             throws java.sql.SQLException
Binds the designated parameter to a oracle.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 object ops and a CLOB named my_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 methods CLOB.getCharacterOutputStream or CLOB.getAsciiOutputStream to write data to a CLOB.

Parameters:
lob - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setCursor

public void setCursor(int paramIndex,
                      java.sql.ResultSet rs)
               throws java.sql.SQLException
Deprecated.  

Binds the designated parameter to a java.sql.ResultSet. This is used for RefCursor parameter only.

NOTE: The method is a misnomer. You should use CURSOR only in callable statements.

Parameters:
rs - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
OracleCallableStatement.getCursor

setCustomDatum

public void setCustomDatum(int paramIndex,
                           CustomDatum x)
                    throws java.sql.SQLException
Deprecated.  

Binds the designated parameter to a oracle.sql.CustomDatum value.

In the 9i release the oracle.sql.CustomDatum has been deprecated and replaced by the oracle.sql.ORAData interface. For this reason, this method is also deprecated. It is recommended to use setORAData() instead.

Parameters:
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
Binds the designated parameter to a oracle.sql.ORAData value.

Parameters:
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
Binds the designated parameter to a oracle.sql.DATE value.

Parameters:
date - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setExecuteBatch

public void setExecuteBatch(int batchValue)
                     throws java.sql.SQLException
Sets the batch value of this statement for the Oracle update batching model (the default value is set by the connection object).

The Oracle update batching model allows you to "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 method.

The batch value for this prepared statement can be set at any time via this method. Changing the batch value will affect all future executes. You can also use OracleConnection.setDefaultExecuteBatch to set a default batch value.

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

Note: It is important to be aware that you cannot mix the Oracle update batching model and the standard one. In any single application, you can use the syntax of one model or the other, but not both. The Oracle JDBC driver will throw exceptions when you mix these syntaxes.

Parameters:
batchValue - batch value to be set. It must be greater than or equal to 1.
Throws:
java.sql.SQLException - is batchValue is <1
See Also:
getExecuteBatch, OracleConnection.setDefaultExecuteBatch

setFixedCHAR

public void setFixedCHAR(int paramIndex,
                         java.lang.String x)
                  throws java.sql.SQLException
Sets the disignated parameter to a String 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 the WHERE clause of a SELECT statement--the character data in the WHERE clause must also be padded to the column width to produce a match in the SELECT statement. This is especially troublesome if you do not know the column width.

setFixedCHAR() remedies this. This method executes a non-padded comparison.

Notes:

The following example demonstrates the difference between the setString(), setCHAR() and setFixedCHAR() 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:
paramIndex - 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

setNUMBER

public void setNUMBER(int paramIndex,
                      NUMBER num)
               throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.NUMBER value.

Parameters:
num - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryFloat

public void setBinaryFloat(int paramIndex,
                           float value)
                    throws java.sql.SQLException
Sets the designated parameter to a Java Float value.

Parameters:
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryFloat

public void setBinaryFloat(int paramIndex,
                           BINARY_FLOAT value)
                    throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_FLOAT value.

Parameters:
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryDouble

public void setBinaryDouble(int paramIndex,
                            double value)
                     throws java.sql.SQLException
Sets the designated parameter to a Java Double value.

Parameters:
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryDouble

public void setBinaryDouble(int paramIndex,
                            BINARY_DOUBLE value)
                     throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value.

Parameters:
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setOPAQUE

public void setOPAQUE(int paramIndex,
                      OPAQUE val)
               throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.OPAQUE value.

Parameters:
val - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setOracleObject

public void setOracleObject(int paramIndex,
                            Datum x)
                     throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.Datum value.

This is a generic setXXX() method for binding oracle.sql. data into a prepared statement as an oracle.sql.Datum object.

Parameters:
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
Binds the bind type of designated parameter from an oracle.sql.StructDescriptor.

Throws:
java.sql.SQLException - if a database access error occurs

setRAW

public void setRAW(int paramIndex,
                   RAW raw)
            throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.RAW value.

Parameters:
raw - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setREF

public void setREF(int paramIndex,
                   REF ref)
            throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.REF value.

Parameters:
ref - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setRefType

public void setRefType(int paramIndex,
                       REF ref)
                throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.REF value.

Note: This is the same as setREF.

Parameters:
ref - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
setREF

setROWID

public void setROWID(int paramIndex,
                     ROWID rowid)
              throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.ROWID value.

Parameters:
rowid - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setSTRUCT

public void setSTRUCT(int paramIndex,
                      STRUCT struct)
               throws java.sql.SQLException
Binds the designated parameter to a oracle.sql.STRUCT value.

Parameters:
struct - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setTIMESTAMP

public void setTIMESTAMP(int paramIndex,
                         TIMESTAMP x)
                  throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.TIMESTAMP value.

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

setTIMESTAMPTZ

public void setTIMESTAMPTZ(int paramIndex,
                           TIMESTAMPTZ x)
                    throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.TIMESTAMPTZ value.

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

setTIMESTAMPLTZ

public void setTIMESTAMPLTZ(int paramIndex,
                            TIMESTAMPLTZ x)
                     throws java.sql.SQLException
Binds the designated parameter to an oracle.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:
paramIndex - specifies the parameter index. Index starts from 1.
x - specifies the parameter value.
Throws:
java.sql.SQLException - if an error occurs
Since:
9i

setINTERVALYM

public void setINTERVALYM(int paramIndex,
                          INTERVALYM x)
                   throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.INTERVALYM value.

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

setINTERVALDS

public void setINTERVALDS(int paramIndex,
                          INTERVALDS x)
                   throws java.sql.SQLException
Binds the designated parameter to an oracle.sql.INTERVALDS value.

Parameters:
paramIndex - specifies the parameter index. Index starts from 1.
x - specifies the parameter value.
Throws:
java.sql.SQLException - if an error occurs
Since:
10i

setNullAtName

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public 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

public void setBinaryFloatAtName(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

setBinaryFloatAtName

public void setBinaryFloatAtName(java.lang.String parameterName,
                                 BINARY_FLOAT value)
                          throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_FLOAT value.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryDoubleAtName

public void setBinaryDoubleAtName(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

setBinaryDoubleAtName

public void setBinaryDoubleAtName(java.lang.String parameterName,
                                  BINARY_DOUBLE value)
                           throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.BINARY_DOUBLE value.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBigDecimalAtName

public 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

public 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

public void setStringForClob(int paramIndex,
                             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:
paramIndex -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setStringForClobAtName

public 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

public 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

public 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

public void setROWIDAtName(java.lang.String parameterName,
                           ROWID value)
                    throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.ROWIDvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setArrayAtName

public 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

public void setARRAYAtName(java.lang.String parameterName,
                           ARRAY value)
                    throws java.sql.SQLException
Sets the designated parameter to a oracle.sql.ARRAY value.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setOPAQUEAtName

public void setOPAQUEAtName(java.lang.String parameterName,
                            OPAQUE value)
                     throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.OPAQUEvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setStructDescriptorAtName

public void setStructDescriptorAtName(java.lang.String parameterName,
                                      StructDescriptor desc)
                               throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.StructDescriptor value.

Parameters:
parameterName -
Throws:
java.sql.SQLException - if a database access error occurs

setSTRUCTAtName

public void setSTRUCTAtName(java.lang.String parameterName,
                            STRUCT value)
                     throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.STRUCTvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setRAWAtName

public void setRAWAtName(java.lang.String parameterName,
                         RAW value)
                  throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.RAWvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setCHARAtName

public 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

public 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

public void setNUMBERAtName(java.lang.String parameterName,
                            NUMBER value)
                     throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.NUMBERvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBLOBAtName

public 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

public 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

setCLOBAtName

public 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

public 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

setBFILEAtName

public void setBFILEAtName(java.lang.String parameterName,
                           BFILE value)
                    throws java.sql.SQLException
Sets the designated parameter to a oracle.sql.BFILEvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBfileAtName

public void setBfileAtName(java.lang.String parameterName,
                           BFILE value)
                    throws java.sql.SQLException
Sets the designated parameter to a oracle.sql.BFILEvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setBytesAtName

public 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

setDateAtName

public 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

setTimeAtName

public 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

setTimestampAtName

public 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

setINTERVALYMAtName

public 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

public 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

public void setTIMESTAMPAtName(java.lang.String parameterName,
                               TIMESTAMP value)
                        throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.TIMESTAMP value.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setTIMESTAMPTZAtName

public void setTIMESTAMPTZAtName(java.lang.String parameterName,
                                 TIMESTAMPTZ value)
                          throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.TIMESTAMPTZ value.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setTIMESTAMPLTZAtName

public void setTIMESTAMPLTZAtName(java.lang.String parameterName,
                                  TIMESTAMPLTZ value)
                           throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.TIMESTAMPLTZ value.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setAsciiStreamAtName

public 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 -
Throws:
java.sql.SQLException - if a database access error occurs

setBinaryStreamAtName

public 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

setUnicodeStreamAtName

public 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

public 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
Throws:
java.sql.SQLException - if a database access error occurs

setORADataAtName

public void setORADataAtName(java.lang.String parameterName,
                             ORAData value)
                      throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.ORADatavalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setObjectAtName

public 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 value
targetSqlType -
scale -
Throws:
java.sql.SQLException - if a database access error occurs

setObjectAtName

public 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 value
Throws:
java.sql.SQLException - if a database access error occurs

setRefTypeAtName

public void setRefTypeAtName(java.lang.String parameterName,
                             REF value)
                      throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.REFvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setRefAtName

public 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

public void setREFAtName(java.lang.String parameterName,
                         REF value)
                  throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.REFvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setObjectAtName

public 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

public void setOracleObjectAtName(java.lang.String parameterName,
                                  Datum value)
                           throws java.sql.SQLException
Sets the designated parameter to an oracle.sql.Datumvalue.

Parameters:
parameterName -
value - the parameter value
Throws:
java.sql.SQLException - if a database access error occurs

setURLAtName

public 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

public 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

public void setPlsqlIndexTable(int paramIndex,
                               java.lang.Object arrayData,
                               int maxLen,
                               int curLen,
                               int elemSqlType,
                               int elemMaxLen)
                        throws java.sql.SQLException
Binds a PL/SQL index-by table parameter in the IN parameter mode.

Parameters:
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.
Throws:
java.sql.SQLException - if a database access error occurs
Since:
8.1.7

setFormOfUse

public void setFormOfUse(int paramIndex,
                         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 and FORM_NCHAR for SQL NCHAR datatypes, where FORM_CHAR is the default. If the "form of use" is set to FORM_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, and CLOB) 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 the oracle.sql package for SQL NCHAR datatypes. Likewise, there is no separate, corresponding constant defined in the oracle.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 the setFormOfUse() 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() and registerOutParameter() 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:
paramIndex - index of the column in the preparedStatment
formOfUse - 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

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.

OracleGetParameterMetaData

public OracleParameterMetaData OracleGetParameterMetaData()
                                                   throws java.sql.SQLException
Retrieves the number, types and properties of this PreparedStatement object's parameters.

Returns:
an OracleParameterMetaData object that contains information about the number, types and properties of this PreparedStatement object's parameters
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2
See Also:
OracleParameterMetaData

Oracle10g JDBC

Copyright © 1998,2004, Oracle. All rights reserved