Oracle10g JDBC

oracle.jdbc.driver
Class OracleStatement

java.lang.Object
  extended byoracle.jdbc.driver.OracleStatement
All Implemented Interfaces:
OracleStatement, oracle.jdbc.internal.OracleStatement, oracle.jdbc.driver.ScrollRsetStatement, java.sql.Statement
Direct Known Subclasses:
OraclePreparedStatement

public abstract class OracleStatement
extends java.lang.Object
implements oracle.jdbc.internal.OracleStatement, oracle.jdbc.driver.ScrollRsetStatement

Oracle statement class.


Field Summary
static java.lang.String BUILD_DATE
           
static boolean PRIVATE_TRACE
           
static boolean TRACE
           
 
Fields inherited from interface oracle.jdbc.internal.OracleStatement
ACTIVE, CACHED, CLOSED, DEFAULT_RSET_TYPE, NON_CACHED
 
Fields inherited from interface oracle.jdbc.OracleStatement
EXPLICIT, IMPLICIT, NEW
 
Method Summary
 void addBatch(java.lang.String sql)
          Add a SQL command to the current batch.
 void cancel()
          Cancel the current statement
 void clearBatch()
          Make the set of commands in the current batch empty.
 void clearDefines()
          Allows the user to clear previously defined types for the define-columns of a select statement.
 void clearWarnings()
          We do not have any statement-level warnings.
 void close()
          Close the current result set, if any, and then close the statement.
 void closeWithKey(java.lang.String key)
          It is illegal to use closeWithKey() for a statement - only valid for PreparedStatements and CallableStatements.
 void defineColumnType(int column_index, int type)
          Define the type under which you will fetch data from the column.
 void defineColumnType(int column_index, int type, int max_size)
          Defines the type you will use to retrieve data from a particular database table column and the maximum size of data you want.
 void defineColumnType(int column_index, int type, int max_size, short form_of_use)
          Defines the type you will use to retrieve data from a particular database table column and the maximum size of data you want.
 void defineColumnType(int column_index, int typeCode, java.lang.String typeName)
          Define the type under which you will fetch data from the column.
 void defineColumnTypeBytes(int column_index, int type, int max_size)
          Define the type under which you will fetch data from the column and the maximum size of data you want, specifying the maximum size in bytes, not characters.
 void defineColumnTypeChars(int column_index, int type, int max_size)
          Define the type under which you will fetch data from the column and the maximum size of data you want, specifying the maximum size in characters, rather than bytes.
 boolean execute(java.lang.String sql)
          Execute a SQL statement.
 boolean execute(java.lang.String sql, int autoGeneratedKeys)
          JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.
 boolean execute(java.lang.String sql, int[] columnIndexes)
          JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
 boolean execute(java.lang.String sql, java.lang.String[] columnNames)
          JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
 int[] executeBatch()
          Submit a batch of commands to the database for execution.
 java.sql.ResultSet executeQuery(java.lang.String sql)
          Execute a query statement.
 int executeUpdate(java.lang.String sql)
          Execute an update statement.
 int executeUpdate(java.lang.String sql, int autoGeneratedKeys)
          JDBC 3.0 Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.
 int executeUpdate(java.lang.String sql, int[] columnIndexes)
          JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
 int executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
          JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
 boolean getAutoRefetch()
          Oracle extension.
 int getcacheState()
           
 java.sql.Connection getConnection()
          JDBC 2.0 Returns the Connection object that produced this Statement object.
 int getFetchDirection()
          JDBC 2.0 Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object.
 int getFetchSize()
          JDBC 2.0 Retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object.
 boolean getFixedString()
          Returns the current setObject(string) behavior for this Statement.
 java.sql.ResultSet getGeneratedKeys()
          JDBC 3.0 Retrieves any auto-generated keys created as a result of executing this Statement object.
 int getMaxFieldSize()
           
 int getMaxRows()
           
 boolean getMoreResults()
          We only have one result and there no way to indicate it.
 boolean getMoreResults(int current)
          JDBC 3.0 Moves to this Statement object's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.
 int getQueryTimeout()
          The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 java.sql.ResultSet getResultSet()
          Allocate a result set.
 int getResultSetConcurrency()
          JDBC 2.0 Retrieves the result set concurrency.
 int getResultSetHoldability()
          JDBC 3.0 Retrieves the result set holdability for ResultSet objects generated by this Statement object.
 int getResultSetType()
          JDBC 2.0 Determine the result set type.
 int getRowPrefetch()
          Allows the user to retrieve the prefetch value for all results sets created from this statement.
 boolean getserverCursor()
           
 int getstatementType()
           
 int getUpdateCount()
           
 java.sql.SQLWarning getWarnings()
          We do not have any statement-level warnings
 boolean isNCHAR(int index)
          isNCHAR (int)
 int sendBatch()
          Void entrypoint so that we do not have to cast statements to OraclePreparedStatements when sending the batch
 void setAutoRefetch(boolean autoRefetch)
          Oracle extension.
 void setCursorName(java.lang.String name)
          We do not support that
 void setEscapeProcessing(boolean enable)
           
 void setFetchDirection(int direction)
          JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed.
 void setFetchSize(int rows)
          JDBC 2.0 Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.
 void setFixedString(boolean fixedString_value)
          Changes the default setObject(string) behavior for this Statement.
 void setMaxFieldSize(int max)
           
 void setMaxRows(int max)
           
 void setQueryTimeout(int max)
          The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 void setResultSetCache(OracleResultSetCache cache)
          Oracle Extenstion Override the default result set cache.
 void setResultSetCache(oracle.jdbc.driver.OracleResultSetCache cache)
          Override the default result set cache.
 void setRowPrefetch(int value)
          setRowPrefetch allows the user to set the row prefetch value for all result sets created from this statement.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE

public static final boolean TRACE
See Also:
Constant Field Values

PRIVATE_TRACE

public static final boolean PRIVATE_TRACE
See Also:
Constant Field Values

BUILD_DATE

public static final java.lang.String BUILD_DATE
See Also:
Constant Field Values
Method Detail

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql)
                                throws java.sql.SQLException
Execute a query statement.

Specified by:
executeQuery in interface java.sql.Statement
Parameters:
sql - SQL statement to be executed. The query is transformed into native SQL.
Returns:
the query result set.
Throws:
java.sql.SQLException - if error(s) occurred.

closeWithKey

public void closeWithKey(java.lang.String key)
                  throws java.sql.SQLException
It is illegal to use closeWithKey() for a statement - only valid for PreparedStatements and CallableStatements.

Specified by:
closeWithKey in interface OracleStatement
Parameters:
key - A key to tag to the statement to be retrieved later
Throws:
java.sql.SQLException - if a database access error occurs

close

public void close()
           throws java.sql.SQLException
Close the current result set, if any, and then close the statement.

Specified by:
close in interface java.sql.Statement
Throws:
java.sql.SQLException - if error(s) occurred.

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
Execute an update statement.

Specified by:
executeUpdate in interface java.sql.Statement
Parameters:
sql - SQL statement to be executed. The query is transformed into native SQL.
Returns:
the resulting update count.
Throws:
java.sql.SQLException - if error(s) occurred.

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
Execute a SQL statement.

Specified by:
execute in interface java.sql.Statement
Parameters:
sql - SQL statement to be executed.
Throws:
java.sql.SQLException - if error(s) occurred.

clearDefines

public void clearDefines()
                  throws java.sql.SQLException
Allows the user to clear previously defined types for the define-columns of a select statement.

This is useful if the user wishes to re-use a statement for a different query.

After calling clearDefines, the user can either perform defines by calling defineColumnType/defineColumnTypeChars or let the driver use the default defines for the table.

To use the clearDefines entrypoint you have to cast the Statement object to the type OracleStatement.

Specified by:
clearDefines in interface OracleStatement
Throws:
java.sql.SQLException - if an error occurs

defineColumnType

public void defineColumnType(int column_index,
                             int type)
                      throws java.sql.SQLException
Define the type under which you will fetch data from the column.
Before executing a Query you may choose to inform JDBC of the type you will use for fetching data from columns. This will save 2 roundtrips to the RDBMS when executing the query as otherwise the JDBC driver has to ask the RDBMS for the column types.

If you decide to define column types you have to declare the types of exactly all columns in the Query. If definition are missing or too many definitions are provided executeQuery will fail with a SQLException.

To use the defineColumnType entrypoint you have to cast the Statement object to the type OracleStatement.

Specified by:
defineColumnType in interface OracleStatement
Parameters:
column_index - Index of column
type - Type to be assigned to column This type could be different from the native type of the column. Appropriate conversions will be done. A subsequent call to getObject() for this column will return the supplied type rather than the native type, however.
Throws:
java.sql.SQLException - if an error occurs
See Also:
defineColumnType(int,int,int), clearDefines

defineColumnType

public void defineColumnType(int column_index,
                             int type,
                             int max_size)
                      throws java.sql.SQLException
Defines the type you will use to retrieve data from a particular database table column and the maximum size of data you want. Depending on the value of the dataSizeUnits connection property, max_size will be measured in bytes or characters.

Specified by:
defineColumnType in interface OracleStatement
Throws:
java.sql.SQLException

defineColumnType

public void defineColumnType(int column_index,
                             int type,
                             int max_size,
                             short form_of_use)
                      throws java.sql.SQLException
Defines the type you will use to retrieve data from a particular database table column and the maximum size of data you want. Depending on the value of the dataSizeUnits connection property, max_size will be measured in bytes or characters. Additionally set the "form of use" parameter which may take the value oracle.jdbc.OraclePreparedStatement.FORM_CHAR to specify that the data be in the database character set or oracle.jdbc.OraclePreparedStatement.FORM_NCHAR to specify that the data be in the national character set.

Specified by:
defineColumnType in interface OracleStatement
Throws:
java.sql.SQLException
Since:
10iR1

defineColumnTypeBytes

public void defineColumnTypeBytes(int column_index,
                                  int type,
                                  int max_size)
                           throws java.sql.SQLException
Define the type under which you will fetch data from the column and the maximum size of data you want, specifying the maximum size in bytes, not characters.
Similarly to the previous void defineColumnType (int column_index, int type) before executing a Query you may choose to inform JDBC of the type you will use for fetching data from columns and the maximum length of data you desire. Each type of data has a default maximum length. This API is useful if you do not wish to get the full default length of data. The actual maximum length of data returned will be the minimum of the following values: If you decide to define column types you have to declare the types of exactly all columns in the Query. Any of the 2 "define" API can be used for any column. If definitions are missing or too many definitions are provided executeQuery will fail with a SQLException.

Similar to the other "define" API, to use the defineColumnType entrypoint you have to cast the Statement object to the type OracleStatement.

The actual maximum length of data returned will be the minimum of the following values:

Specified by:
defineColumnTypeBytes in interface OracleStatement
Parameters:
column_index - Index of column
type - Type to be assigned to column This type could be different from the native type of the column. Appropriate conversions will be done. A subsequent call to getObject() for this column will return the supplied type rather than the native type, however.
max_size - Maximum length of data that the user wants for this column. This value is specified in bytes, not characters. To specify the maximum length in characters, use the defineColumnTypeChars entrypoint.
Throws:
java.sql.SQLException - if an error occurs
See Also:
defineColumnType(int,int), clearDefines

defineColumnTypeChars

public void defineColumnTypeChars(int column_index,
                                  int type,
                                  int max_size)
                           throws java.sql.SQLException
Define the type under which you will fetch data from the column and the maximum size of data you want, specifying the maximum size in characters, rather than bytes. For non-character types, this entrypoint behaves the same as defineColumnType.
Similarly to the previous void defineColumnType (int column_index, int type) before executing a Query you may choose to inform JDBC of the type you will use for fetching data from columns and the maximum length of data you desire. Each type of data has a default maximum length. This API is useful if you do not wish to get the full default length of data. The actual maximum length of data returned will be the minimum of the following values: If you decide to define column types you have to declare the types of exactly all columns in the Query. Any of the 2 "define" API can be used for any column. If definitions are missing or too many definitions are provided executeQuery will fail with a SQLException.

Similar to the other "define" API, to use the defineColumnTypeChars entrypoint you have to cast the Statement object to the type OracleStatement.

The actual maximum length of data returned will be the minimum of the following values:

Specified by:
defineColumnTypeChars in interface OracleStatement
Parameters:
column_index - Index of column
type - Type to be assigned to column This type could be different from the native type of the column. Appropriate conversions will be done.
max_size - Maximum length of data that the user wants for this column. This value is specified in characters, not bytes. To specify the maximum length in bytes, use the defineColumnType entrypoint.
Throws:
java.sql.SQLException - if an error occurs
See Also:
defineColumnType(int,int), clearDefines

defineColumnType

public void defineColumnType(int column_index,
                             int typeCode,
                             java.lang.String typeName)
                      throws java.sql.SQLException
Define the type under which you will fetch data from the column.
Before executing a query you may choose to inform JDBC of the type you will use for fetching data from columns. This will save 2 roundtrips to the RDBMS when executing the query as otherwise the JDBC driver has to ask the RDBMS for the column types.

If you decide to define column types you have to declare the types of exactly all columns in the Query. If definition are missing or too many definitions are provided executeQuery will fail with a SQLException.

To use the defineColumnType entrypoint you have to cast the Statement object to the type OracleStatement.

Specified by:
defineColumnType in interface OracleStatement
Parameters:
column_index - Index of column
typeCode - Type code for this column.
typeName - specifies the fully-qualified name of the column if typeCode is OracleTypes.REF_TYPE or OracleTypes.STRUCT or OracleTypes.ARRAY. This parameter is ignored for other type codes.
Throws:
java.sql.SQLException - if an error occurs
See Also:
defineColumnType(int,int), clearDefines

setRowPrefetch

public void setRowPrefetch(int value)
                    throws java.sql.SQLException
setRowPrefetch allows the user to set the row prefetch value for all result sets created from this statement.

setRowPrefetch overrides the prefetch value set from the connection, for this particular statement.

The row_prefetch will be turned back to 1 automatically by the driver if any of the select-column types is streaming (long data or long raw data). This is overrides any value the user might set. Also, this will be done regardless of wether the streaming columns are read or not.

To use the setRowPrefetch entrypoint you have to cast the Statement object to the type OracleStatement.

Specified by:
setRowPrefetch in interface OracleStatement
Parameters:
value - the number of rows to prefetch
Throws:
java.sql.SQLException - if the argument value is <=0
See Also:
getRowPrefetch, OracleConnection.setDefaultRowPrefetch

getRowPrefetch

public int getRowPrefetch()
Allows the user to retrieve the prefetch value for all results sets created from this statement.

To use the getRowPrefetch entrypoint you have to cast the Statement object to the type OracleStatement.

Specified by:
getRowPrefetch in interface OracleStatement
Returns:
the row prefetch value
See Also:
setRowPrefetch, OracleConnection.setDefaultRowPrefetch

setFixedString

public void setFixedString(boolean fixedString_value)
Changes the default setObject(string) behavior for this Statement.

By default, a call to PreparedStatement.setObject() with a String will bind the string using Types.VARCHAR, which will use non blank-padded character comparison semantics. This is in accordance with the JDBC specification.

This behavior can be changed for this Statement by passing false to setFixedString().

Specified by:
setFixedString in interface oracle.jdbc.internal.OracleStatement
See Also:
getFixedString

getFixedString

public boolean getFixedString()
Returns the current setObject(string) behavior for this Statement.

By default, a call to PreparedStatement.setObject() with a String will bind the string using Types.VARCHAR, which will use non blank-padded character comparison semantics. This is in accordance with the JDBC specification.

This behavior can be changed for this Statement by passing false to setFixedString().

Specified by:
getFixedString in interface oracle.jdbc.internal.OracleStatement
Returns:
The current setting. If true, then setObject(x, String) calls will bind with Types.FIXED_CHAR rather than Types.VARCHAR, which will result in blank-padded character comparison semantics.
See Also:
setFixedString

getMaxFieldSize

public int getMaxFieldSize()
                    throws java.sql.SQLException
Specified by:
getMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxFieldSize

public void setMaxFieldSize(int max)
                     throws java.sql.SQLException
Specified by:
setMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException

getMaxRows

public int getMaxRows()
               throws java.sql.SQLException
Specified by:
getMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

setMaxRows

public void setMaxRows(int max)
                throws java.sql.SQLException
Specified by:
setMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException

setEscapeProcessing

public void setEscapeProcessing(boolean enable)
                         throws java.sql.SQLException
Specified by:
setEscapeProcessing in interface java.sql.Statement
Throws:
java.sql.SQLException

getQueryTimeout

public int getQueryTimeout()
                    throws java.sql.SQLException
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.

Specified by:
getQueryTimeout in interface java.sql.Statement
Returns:
the current query timeout limit in seconds; zero means unlimited
Throws:
java.sql.SQLException

setQueryTimeout

public void setQueryTimeout(int max)
                     throws java.sql.SQLException
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.

Specified by:
setQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException

cancel

public void cancel()
            throws java.sql.SQLException
Cancel the current statement

Specified by:
cancel in interface java.sql.Statement
Throws:
java.sql.SQLException

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
We do not have any statement-level warnings

Specified by:
getWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
We do not have any statement-level warnings.

Specified by:
clearWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException

setCursorName

public void setCursorName(java.lang.String name)
                   throws java.sql.SQLException
We do not support that

Specified by:
setCursorName in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException
Allocate a result set. I'm not sure if we should clear the warnings here or not.

Specified by:
getResultSet in interface java.sql.Statement
Throws:
java.sql.SQLException

getUpdateCount

public int getUpdateCount()
                   throws java.sql.SQLException
Specified by:
getUpdateCount in interface java.sql.Statement
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults()
                       throws java.sql.SQLException
We only have one result and there no way to indicate it.

Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException

sendBatch

public int sendBatch()
              throws java.sql.SQLException
Void entrypoint so that we do not have to cast statements to OraclePreparedStatements when sending the batch

Specified by:
sendBatch in interface oracle.jdbc.internal.OracleStatement
Throws:
java.sql.SQLException

setFetchDirection

public void setFetchDirection(int direction)
                       throws java.sql.SQLException
JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. Oracle JDBC driver only supports FETCH_FORWARD; changing fetch direction to FETCH_REVERSE or FETCH_UNKNOWN is ignored.

Specified by:
setFetchDirection in interface java.sql.Statement
Parameters:
direction - the initial direction for processing rows
Throws:
java.sql.SQLException - if a database access error occurs

getFetchDirection

public int getFetchDirection()
                      throws java.sql.SQLException
JDBC 2.0 Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object. Since Oracle database only supports forward only cursor. This method always return FETCH_FORWARD.

Specified by:
getFetchDirection in interface java.sql.Statement
Returns:
the default fetch direction for result sets generated from this Statement object
Throws:
java.sql.SQLException - if a database access error occurs

setFetchSize

public void setFetchSize(int rows)
                  throws java.sql.SQLException
JDBC 2.0 Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified affects only result sets created using this statement. If the value specified is zero, the connection default row prefetch size is used.

Specified by:
setFetchSize in interface java.sql.Statement
Parameters:
rows - the number of rows to fetch
Throws:
java.sql.SQLException - if a database access error occurs, or the condition 0 <= rows <= this.getMaxRows() is not satisfied.

getFetchSize

public int getFetchSize()
                 throws java.sql.SQLException
JDBC 2.0 Retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object. If this Statement object has not set a fetch size by calling the method setFetchSize, the return value is the connection default prefetch size.

Specified by:
getFetchSize in interface java.sql.Statement
Returns:
the default fetch size for result sets generated from this Statement object
Throws:
java.sql.SQLException - if a database access error occurs

getResultSetConcurrency

public int getResultSetConcurrency()
                            throws java.sql.SQLException
JDBC 2.0 Retrieves the result set concurrency.

Specified by:
getResultSetConcurrency in interface java.sql.Statement
Throws:
java.sql.SQLException

getResultSetType

public int getResultSetType()
                     throws java.sql.SQLException
JDBC 2.0 Determine the result set type.

Specified by:
getResultSetType in interface java.sql.Statement
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
JDBC 2.0 Returns the Connection object that produced this Statement object.

Specified by:
getConnection in interface java.sql.Statement
Returns:
the connection that produced this statement
Throws:
java.sql.SQLException - if a database access error occurs

setResultSetCache

public void setResultSetCache(OracleResultSetCache cache)
                       throws java.sql.SQLException
Oracle Extenstion Override the default result set cache.

Specified by:
setResultSetCache in interface OracleStatement
Parameters:
cache - is a OracleResultSetCache instance
Throws:
java.sql.SQLException - if cache is null or if an error occurs when calling close() on cache

setResultSetCache

public void setResultSetCache(oracle.jdbc.driver.OracleResultSetCache cache)
                       throws java.sql.SQLException
Override the default result set cache. This is an Oracle extension API.

Parameters:
cache - result set cache to be used.
Throws:
java.sql.SQLException

addBatch

public void addBatch(java.lang.String sql)
              throws java.sql.SQLException
Add a SQL command to the current batch.

Specified by:
addBatch in interface java.sql.Statement
Parameters:
sql - typically this is a static SQL INSERT or UPDATE statement.
Throws:
java.sql.SQLException - if an error occurred.
Since:
8.1.6 (JDBC 2.0).

clearBatch

public void clearBatch()
                throws java.sql.SQLException
Make the set of commands in the current batch empty.

Specified by:
clearBatch in interface java.sql.Statement
Throws:
java.sql.SQLException - if a database access error occurred.
Since:
81.6 (JDBC 2.0).

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
Submit a batch of commands 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.

Specified by:
executeBatch in interface java.sql.Statement
Returns:
an array of update counts containing one element for each command in the batch. The array is ordered according to the order in which commands were inserted into the batch.
Throws:
java.sql.BatchUpdateException - if any of the commands in the batch failed to execute property. (For example, the batch will fail if it contained a command that returns a result set.) executeBatch() will stop when the first command returns an error. The update counts for the executed commands can be obtained by invoking the method BatchUpdateException.getUpdateCounts().
java.sql.SQLException
Since:
8.1.6 (JDBC 2.0).

setAutoRefetch

public void setAutoRefetch(boolean autoRefetch)
                    throws java.sql.SQLException
Oracle extension. Set the default state of ResultSet's auto-refetch mode of the statement. If a ResultSet is in auto-refetch mode, then it automatically refetches the column values during updateRow(). Otherwise, the column values in the ResultSet are the same as the value from the updateXXX() calls which may not be in sync with the database column values if a database trigger is enabled to modify the column values. Disable auto-refetch improves performance by avoiding one database round-trip druing the updateRow() call. By default, the connection's default auto-refetech value is true.

Specified by:
setAutoRefetch in interface oracle.jdbc.driver.ScrollRsetStatement
Parameters:
autoRefetch - true enables auto-refetch; false disables auto-refetch.
Throws:
java.sql.SQLException - if a database access error occurs
Since:
8.1.7
See Also:
OracleConnection#setDefaultAutoRefetch, OracleResultSet.setAutoRefetch(boolean)

getAutoRefetch

public boolean getAutoRefetch()
                       throws java.sql.SQLException
Oracle extension. Gets the default auto-refetch state of this statement.

Specified by:
getAutoRefetch in interface oracle.jdbc.driver.ScrollRsetStatement
Returns:
the current state of auot-refetch mode
Throws:
java.sql.SQLException - if a database access error occurs
Since:
8.1.7
See Also:
setAutoRefetch(boolean)

isNCHAR

public boolean isNCHAR(int index)
                throws java.sql.SQLException
isNCHAR (int)

Specified by:
isNCHAR in interface OracleStatement
Parameters:
index - the column index
Returns:
true if the column is of type NCHAR/NVARCHAR/NCLOB false if the column is not of type NCHAR/NVARCHAR/NCLOB
Throws:
java.sql.SQLException

getMoreResults

public boolean getMoreResults(int current)
                       throws java.sql.SQLException
JDBC 3.0 Moves to this Statement object's next result, deals with any current ResultSet object(s) according to the instructions specified by the given flag, and returns true if the next result is a ResultSet object.

There are no more results when the following is true:

         (!getMoreResults() && (getUpdateCount() == -1)
    

Specified by:
getMoreResults in interface java.sql.Statement
Parameters:
current - one of the following Statement constants indicating what should happen to current ResultSet objects obtained using the method getResultSetCLOSE_CURRENT_RESULT, KEEP_CURRENT_RESULT, or CLOSE_ALL_RESULTS
Returns:
true if the next result is a ResultSet object; false if it is an update count or there are no more results
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2
See Also:
execute(java.lang.String)

getGeneratedKeys

public java.sql.ResultSet getGeneratedKeys()
                                    throws java.sql.SQLException
JDBC 3.0 Retrieves any auto-generated keys created as a result of executing this Statement object. If this Statement object did not generate any keys, an empty ResultSet object is returned.

Specified by:
getGeneratedKeys in interface java.sql.Statement
Returns:
a ResultSet object containing the auto-generated key(s) generated by the execution of this Statement object
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int autoGeneratedKeys)
                  throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval.

Specified by:
executeUpdate in interface java.sql.Statement
Parameters:
sql - must be an SQL INSERT, UPDATE or DELETE statement or an SQL statement that returns nothing
autoGeneratedKeys - a flag indicating whether auto-generated keys should be made available for retrieval; one of the following constants: Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS
Returns:
either the row count for INSERT, UPDATE or DELETE statements, or 0 for SQL statements that return nothing
Throws:
java.sql.SQLException - if a database access error occurs, the given SQL statement returns a ResultSet object, or the given constant is not one of those allowed
Since:
9.0.2

executeUpdate

public int executeUpdate(java.lang.String sql,
                         int[] columnIndexes)
                  throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement.

Specified by:
executeUpdate in interface java.sql.Statement
Parameters:
sql - an SQL INSERT, UPDATE or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement
columnIndexes - an array of column indexes indicating the columns that should be returned from the inserted row
Returns:
either the row count for INSERT, UPDATE, or DELETE statements, or 0 for SQL statements that return nothing
Throws:
java.sql.SQLException - if a database access error occurs or the SQL statement returns a ResultSet object
Since:
9.0.2

executeUpdate

public int executeUpdate(java.lang.String sql,
                         java.lang.String[] columnNames)
                  throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement.

Specified by:
executeUpdate in interface java.sql.Statement
Parameters:
sql - an SQL INSERT, UPDATE or DELETE statement or an SQL statement that returns nothing
columnNames - an array of the names of the columns that should be returned from the inserted row
Returns:
either the row count for INSERT, UPDATE, or DELETE statements, or 0 for SQL statements that return nothing
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2

execute

public boolean execute(java.lang.String sql,
                       int autoGeneratedKeys)
                throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. The driver will ignore this signal if the SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Specified by:
execute in interface java.sql.Statement
Parameters:
sql - any SQL statement
autoGeneratedKeys - a constant indicating whether auto-generated keys should be made available for retrieval using the method getGeneratedKeys; one of the following constants: Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2
See Also:
getResultSet(), getUpdateCount(), getMoreResults(), getGeneratedKeys()

execute

public boolean execute(java.lang.String sql,
                       int[] columnIndexes)
                throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT statement.

Under some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Specified by:
execute in interface java.sql.Statement
Parameters:
sql - any SQL statement
columnIndexes - an array of the indexes of the columns in the inserted row that should be made available for retrieval by a call to the method getGeneratedKeys
Returns:
true if the first result is a ResultSet object; false if it is an update count or there are no results
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2
See Also:
getResultSet(), getUpdateCount(), getMoreResults()

execute

public boolean execute(java.lang.String sql,
                       java.lang.String[] columnNames)
                throws java.sql.SQLException
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Specified by:
execute in interface java.sql.Statement
Parameters:
sql - any SQL statement
columnNames - an array of the names of the columns in the inserted row that should be made available for retrieval by a call to the method getGeneratedKeys
Returns:
true if the next result is a ResultSet object; false if it is an update count or there are no more results
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2
See Also:
getResultSet(), getUpdateCount(), getMoreResults(), getGeneratedKeys()

getResultSetHoldability

public int getResultSetHoldability()
                            throws java.sql.SQLException
JDBC 3.0 Retrieves the result set holdability for ResultSet objects generated by this Statement object.

Specified by:
getResultSetHoldability in interface java.sql.Statement
Returns:
either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
Throws:
java.sql.SQLException - if a database access error occurs
Since:
9.0.2

getcacheState

public int getcacheState()
Specified by:
getcacheState in interface oracle.jdbc.internal.OracleStatement

getstatementType

public int getstatementType()
Specified by:
getstatementType in interface oracle.jdbc.internal.OracleStatement

getserverCursor

public boolean getserverCursor()
Specified by:
getserverCursor in interface oracle.jdbc.internal.OracleStatement

Oracle10g JDBC

Copyright © 1998,2004, Oracle. All rights reserved