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.
-
auto_rollback
-
-
closed
-
-
dbstmt
-
-
defines
-
-
wait_option
-
-
addBatch(String)
- Add a SQL command to the current batch.
-
cancel()
- Cancel the current statement
-
clearBatch()
- Make the set of commands in the current batch empty.
-
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.
-
clearWarnings()
- We do not have any statement-level warnings.
-
close()
- Close the current result set, if any, and then close the statement.
-
defineColumnType(int, int)
-
Define the type under which you will fetch data from the column.
-
defineColumnType(int, int, int)
- Define the type under which you will fetch data from the column
and the maximum size of data you want.
-
defineColumnType(int, int, String)
-
Define the type under which you will fetch data from the column.
-
execute(String)
- Execute a SQL statement.
-
executeBatch()
- Submit a batch of commands to the database for execution.
-
executeQuery(String)
- Execute a query statement.
-
executeUpdate(String)
- Execute an update statement.
-
getAutoRollback()
-
Deprecated.
-
getConnection()
- JDBC 2.0
Returns the
Connection
object
that produced this Statement
object.
-
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.
-
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.
-
getMaxFieldSize()
-
-
getMaxRows()
-
-
getMoreResults()
- We only have one result and there no way to indicate it.
-
getOriginalSql()
-
-
getQueryTimeout()
- The queryTimeout limit is the number of seconds the driver will
wait for a Statement to execute.
-
getResultSet()
- Allocate a result set.
-
getResultSetConcurrency()
- JDBC 2.0
Retrieves the result set concurrency.
-
getResultSetType()
- JDBC 2.0
Determine the result set type.
-
getRevisedSql()
-
-
getRowPrefetch()
- Allows the user to retrieve the prefetch value for all results
sets created from this statement.
-
getUpdateCount()
-
-
getWaitOption()
-
Deprecated.
-
getWarnings()
- We do not have any statement-level warnings
-
sendBatch()
- Void entrypoint so that we do not have to cast statements to
OraclePreparedStatements when sending the batch
-
setAutoRollback(int)
-
Deprecated.
-
setCursorName(String)
- We do not support that
-
setEscapeProcessing(boolean)
-
-
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.
-
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.
-
setMaxFieldSize(int)
-
-
setMaxRows(int)
-
-
setQueryTimeout(int)
- The queryTimeout limit is the number of seconds the driver will
wait for a Statement to execute.
-
setResultSetCache(OracleResultSetCache)
- Oracle Extenstion
Override the default result set cache.
-
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).
-
setWaitOption(int)
-
Deprecated.
defines
public DBDataSet defines
dbstmt
public DBStatement dbstmt
closed
public boolean closed
auto_rollback
public int auto_rollback
wait_option
public int wait_option
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.
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.
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.
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.
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
.
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
.
Notes:
- When reading the value of an out parameter you don't have to
use the getXXX method whose Java type XXX corresponds to the
parameter's registered SQL type. It's just faster if you do as
the data has already been converted to the right type.
- 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.
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:
- maximum size passed in to this "define" method
- the maximum field size that can be set by the JDBC API
"setMaxFieldSize (int).
- the "natural" maximum size of the data based on its type.
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 same conditions as for the other 'define" API apply here:
- When reading the value of an out parameter you don't have to
use the getXXX method whose Java type XXX corresponds to the
parameter's registered SQL type. It's just faster if you do as
the data has already been converted to the right type.
The actual maximum length of data returned
will be the minimum of the following values:
- maximum size passed in to this "define" method
- the maximum field size that can be set by the JDBC API
"setMaxFieldSize (int).
- the "natural" maximum size of the data based on its type.
- 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.
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
.
Notes:
- When reading the value of an out parameter you don't have to
use the getXXX method whose Java type XXX corresponds to the
parameter's registered SQL type. It's just faster if you do as
the data has already been converted to the right type.
- 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.
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
.
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
.
getMaxFieldSize
public synchronized int getMaxFieldSize() throws SQLException
setMaxFieldSize
public synchronized void setMaxFieldSize(int max) throws SQLException
getMaxRows
public int getMaxRows() throws SQLException
setMaxRows
public synchronized void setMaxRows(int max) throws SQLException
setEscapeProcessing
public synchronized void setEscapeProcessing(boolean enable) throws SQLException
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
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
cancel
public void cancel() throws SQLException
- Cancel the current statement
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.
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.
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.
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.
getWarnings
public SQLWarning getWarnings() throws SQLException
- We do not have any statement-level warnings
clearWarnings
public void clearWarnings() throws SQLException
- We do not have any statement-level warnings.
setCursorName
public void setCursorName(String name) throws SQLException
- We do not support that
getResultSet
public synchronized ResultSet getResultSet() throws SQLException
- Allocate a result set. I'm not sure if we should clear the warnings
here or not.
getUpdateCount
public synchronized int getUpdateCount() throws SQLException
getMoreResults
public boolean getMoreResults() throws SQLException
- We only have one result and there no way to indicate it.
sendBatch
public int sendBatch() throws SQLException
- Void entrypoint so that we do not have to cast statements to
OraclePreparedStatements when sending the batch
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
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
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.
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
getResultSetConcurrency
public int getResultSetConcurrency() throws SQLException
- JDBC 2.0
Retrieves the result set concurrency.
getResultSetType
public int getResultSetType() throws SQLException
- JDBC 2.0
Determine the result set type.
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
setResultSetCache
public synchronized void setResultSetCache(OracleResultSetCache cache) throws SQLException
- Oracle Extenstion
Override the default result set cache.
- Parameters:
- cache - is a OracleResultSetCache instance
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.
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.
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().
getRevisedSql
public String getRevisedSql() throws SQLException
getOriginalSql
public String getOriginalSql() throws SQLException
All Packages Class Hierarchy This Package Previous Next Index