oracle.jdbc
Interface OracleStatement

All Known Subinterfaces:
OracleCallableStatement, OraclePreparedStatement

public abstract interface OracleStatement
extends java.sql.Statement


Field Summary
static int EXPLICIT
           
static int IMPLICIT
           
static int NEW
           
 
Method Summary
 void 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.
 void closeWithKey(java.lang.String key)
          The underlying cursor is not closed and the Statement handle is cached on the Key.
 int creationState()
          Returns the Creation Status of this Statement.
 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)
          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 defineColumnType(int column_index, int typeCode, java.lang.String typeName)
          Define the type under which you will fetch data from the column.
 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.
 int getRowPrefetch()
          Allows the user to retrieve the prefetch value for all results sets created from this statement.
 void setResultSetCache(OracleResultSetCache cache)
          Oracle Extenstion 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. 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).
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, execute, executeBatch, executeQuery, executeUpdate, getConnection, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 

Field Detail

NEW

public static final int NEW

IMPLICIT

public static final int IMPLICIT

EXPLICIT

public static final int EXPLICIT
Method Detail

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 setDefaultRowPrefetch entrypoint you have to cast the Statement object to the type oracle.jdbc.driver.OracleStatement.


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 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. A subsequent call to getObject() for this column will return the supplied type rather than the native type, however.

defineColumnType

public void defineColumnType(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 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. 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.

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 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. This value is specified in characters, not bytes. To specify the maximum length in bytes, use the defineColumnType entrypoint.

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 oracle.jdbc.driver.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.

getRowPrefetch

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


setResultSetCache

public void setResultSetCache(OracleResultSetCache cache)
                       throws java.sql.SQLException
Oracle Extenstion Override the default result set cache.
Parameters:
cache - is a OracleResultSetCache instance

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 setDefaultRowPrefetch entrypoint you have to cast the Statement object to the type oracle.jdbc.driver.OracleStatement.


closeWithKey

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

creationState

public int creationState()
Returns the Creation Status of this Statement. Whether it is a new created or returned from KEY based cache or internal cache. Possible returns values are :

OracleStatement.NEW (0) OracleStatement.IMPLICIT (1) OracleStatement.EXPLICIT (2)

Returns:
Creation Status flag