All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class oracle.jdbc.driver.OracleStatement

java.lang.Object
   |
   +----oracle.jdbc.driver.OracleStatement

public class OracleStatement
extends Object
implements Statement
Oracle statement class.


Variable Index

 o auto_rollback
 o closed
 o dbstmt
 o defines
 o wait_option

Method Index

 o addBatch(String)
Add a SQL command to the current batch.
 o cancel()
Cancel the current statement
 o clearBatch()
Make the set of commands in the current batch empty.
 o clearDefines()
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.

 o clearWarnings()
We do not have any statement-level warnings.
 o close()
Close the current result set, if any, and then close the statement.
 o defineColumnType(int, int)
Define the type under which you will fetch data from the column.
 o defineColumnType(int, int, int)
Define the type under which you will fetch data from the column and the maximum size of data you want.
 o defineColumnType(int, int, String)
Define the type under which you will fetch data from the column.
 o execute(String)
Execute a SQL statement.
 o executeBatch()
Submit a batch of commands to the database for execution.
 o executeQuery(String)
Execute a query statement.
 o executeUpdate(String)
Execute an update statement.
 o getAutoRollback()
Deprecated.
 o getConnection()
JDBC 2.0 Returns the Connection object that produced this Statement object.
 o 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.
 o 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.
 o getMaxFieldSize()
 o getMaxRows()
 o getMoreResults()
We only have one result and there no way to indicate it.
 o getOriginalSql()
 o getQueryTimeout()
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 o getResultSet()
Allocate a result set.
 o getResultSetConcurrency()
JDBC 2.0 Retrieves the result set concurrency.
 o getResultSetType()
JDBC 2.0 Determine the result set type.
 o getRevisedSql()
 o getRowPrefetch()
Allows the user to retrieve the prefetch value for all results sets created from this statement.
 o getUpdateCount()
 o getWaitOption()
Deprecated.
 o getWarnings()
We do not have any statement-level warnings
 o sendBatch()
Void entrypoint so that we do not have to cast statements to OraclePreparedStatements when sending the batch
 o setAutoRollback(int)
Deprecated.
 o setCursorName(String)
We do not support that
 o setEscapeProcessing(boolean)
 o setFetchDirection(int)
JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed.
 o setFetchSize(int)
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.
 o setMaxFieldSize(int)
 o setMaxRows(int)
 o setQueryTimeout(int)
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute.
 o setResultSetCache(OracleResultSetCache)
Oracle Extenstion Override the default result set cache.
 o setRowPrefetch(int)
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).

 o setWaitOption(int)
Deprecated.

Variables

 o defines
 public DBDataSet defines
 o dbstmt
 public DBStatement dbstmt
 o closed
 public boolean closed
 o auto_rollback
 public int auto_rollback
 o wait_option
 public int wait_option

Methods

 o executeQuery
 public synchronized ResultSet executeQuery(String sql) throws SQLException
Execute a query statement.

Parameters:
sql SQL - statement to be executed. The query is transformed into native SQL.
Returns:
the query result set.
Throws: SQLException
if error(s) occurred.
 o close
 public synchronized void close() throws SQLException
Close the current result set, if any, and then close the statement.

Throws: SQLException
if error(s) occurred.
 o executeUpdate
 public synchronized int executeUpdate(String sql) throws SQLException
Execute an update statement.

Parameters:
sql SQL - statement to be executed. The query is transformed into native SQL.
Returns:
the resulting update count.
Throws: SQLException
if error(s) occurred.
 o execute
 public synchronized boolean execute(String sql) throws SQLException
Execute a SQL statement.

Parameters:
sql SQL - statement to be executed.
Throws: SQLException
if error(s) occurred.
 o clearDefines
 public synchronized void clearDefines() throws 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 or let the driver use the default defines for the table.

To use the setDefaultRowPrefetch entrypoint you have to cast the Statement object to the type oracle.jdbc.driver.OracleStatement.

 o defineColumnType
 public synchronized void defineColumnType(int column_index,
                                           int type) throws 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 oracle.jdbc.driver.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.
 o defineColumnType
 public synchronized void defineColumnType(int column_index,
                                           int type,
                                           int max_size) throws SQLException
Define the type under which you will fetch data from the column and the maximum size of data you want.
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 oracle.jdbc.driver.OracleStatement.

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

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.
 o defineColumnType
 public synchronized void defineColumnType(int column_index,
                                           int typeCode,
                                           String typeName) throws 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 oracle.jdbc.driver.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.
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.
max_size - Maximum length of data that the user wants for this column.
 o setRowPrefetch
 public synchronized void setRowPrefetch(int value) throws 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 setDefaultRowPrefetch entrypoint you have to cast the Statement object to the type oracle.jdbc.driver.OracleStatement.

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

To use the setDefaultRowPrefetch entrypoint you have to cast the Statement object to the type oracle.jdbc.driver.OracleStatement.

 o getMaxFieldSize
 public synchronized int getMaxFieldSize() throws SQLException
 o setMaxFieldSize
 public synchronized void setMaxFieldSize(int max) throws SQLException
 o getMaxRows
 public int getMaxRows() throws SQLException
 o setMaxRows
 public synchronized void setMaxRows(int max) throws SQLException
 o setEscapeProcessing
 public synchronized void setEscapeProcessing(boolean enable) throws SQLException
 o getQueryTimeout
 public synchronized int getQueryTimeout() throws 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.

Returns:
the current query timeout limit in seconds; zero means unlimited
 o setQueryTimeout
 public synchronized void setQueryTimeout(int max) throws 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.

Parameters:
seconds - the new query timeout limit in seconds; zero means unlimit ed
 o cancel
 public void cancel() throws SQLException
Cancel the current statement

 o setAutoRollback
 public synchronized void setAutoRollback(int autoRollback) throws SQLException
Note: setAutoRollback() is deprecated. As of JDBC 8.1.6. No Replacement. 933355: Transaction management, if different from the default behavior, should be handled by the user at the application level. if autoRollback is 0, then non fatal errors will cause the the current transaction to be rollwd back. if autoRollback is 2, then only the failing row will be rolled back.

 o getAutoRollback
 public synchronized int getAutoRollback() throws SQLException
Note: getAutoRollback() is deprecated. As of JDBC 8.1.6. No Replacement. 933355: Transaction management, if different from the default behavior, should be handled by the user at the application level.

 o setWaitOption
 public synchronized void setWaitOption(int waitOption) throws SQLException
Note: setWaitOption() is deprecated. As of JDBC 8.1.6. No Replacement. 933355: Time to wait for resources, if different from the default behavior, should be handled by the user at the application level. if waitOption is 0, program will wait indefinitely for resource. if waitOption is 4, program will receive an error message when a requested resource is not available.

 o getWaitOption
 public synchronized int getWaitOption() throws SQLException
Note: getWaitOption() is deprecated. As of JDBC 8.1.6. No Replacement. 933355: Time to wait for resources, if different from the default behavior, should be handled by the user at the application level.

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

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

 o setCursorName
 public void setCursorName(String name) throws SQLException
We do not support that

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

 o getUpdateCount
 public synchronized int getUpdateCount() throws SQLException
 o getMoreResults
 public boolean getMoreResults() throws SQLException
We only have one result and there no way to indicate it.

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

 o setFetchDirection
 public synchronized void setFetchDirection(int direction) throws 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.

Parameters:
direction - the initial direction for processing rows
Throws: SQLException
if a database access error occurs
 o getFetchDirection
 public int getFetchDirection() throws 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.

Returns:
the default fetch direction for result sets generated from this Statement object
Throws: SQLException
if a database access error occurs
 o setFetchSize
 public synchronized void setFetchSize(int rows) throws 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.

Parameters:
rows - the number of rows to fetch
Throws: SQLException
if a database access error occurs, or the condition 0 <= rows <= this.getMaxRows() is not satisfied.
 o getFetchSize
 public int getFetchSize() throws 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.

Returns:
the default fetch size for result sets generated from this Statement object
Throws: SQLException
if a database access error occurs
 o getResultSetConcurrency
 public int getResultSetConcurrency() throws SQLException
JDBC 2.0 Retrieves the result set concurrency.

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

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

Returns:
the connection that produced this statement
Throws: SQLException
if a database access error occurs
 o setResultSetCache
 public synchronized void setResultSetCache(OracleResultSetCache cache) throws SQLException
Oracle Extenstion Override the default result set cache.

Parameters:
cache - is a OracleResultSetCache instance
 o addBatch
 public synchronized void addBatch(String sql) throws SQLException
Add a SQL command to the current batch.

Parameters:
sql typically - this is a static SQL INSERT or UPDATE statement.
Throws: SQLException
if an error occurred.
 o clearBatch
 public synchronized void clearBatch() throws SQLException
Make the set of commands in the current batch empty.

Throws: SQLException
if a database access error occurred.
 o executeBatch
 public synchronized int[] executeBatch() throws 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.

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: 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().
 o getRevisedSql
 public String getRevisedSql() throws SQLException
 o getOriginalSql
 public String getOriginalSql() throws SQLException

All Packages  Class Hierarchy  This Package  Previous  Next  Index