|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PreparedStatement
An interface for a Precompiled SQL Statement.
An SQL Statement is put into a PreparedStatement and is precompiled so that it can be executed multiple times efficiently.
Setter methods are supplied in the PreparedStatement interface for the setting of IN parameters for the Statement. The setter method used for each IN parameter must match the type of the IN parameter being set.
Field Summary |
---|
Fields inherited from interface oracle.adfnmc.java.sql.Statement |
---|
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
Method Summary | |
---|---|
void |
addBatch()
Add a set of parameters to the PreparedStatement's command batch. |
void |
clearParameters()
Clear the current parameter values. |
boolean |
execute()
Executes the SQL statement in this PreparedStatement. |
ResultSet |
executeQuery()
Execute the SQL query in the PreparedStatement and return the ResultSet generated by the query. |
int |
executeUpdate()
Invoke the SQL command contained within the Prepared Statement. |
ResultSetMetaData |
getMetaData()
Returns a ResultSetMetaData containing data from the ResultSet that is produced when the PreparedStatement is invoked. |
ParameterMetaData |
getParameterMetaData()
Gets information about the parameters of the PreparedStatement. |
void |
setArray(int parameterIndex,
Array theArray)
Sets the value of a specified parameter to the supplied Array object. |
void |
setAsciiStream(int parameterIndex,
java.io.InputStream theInputStream,
int length)
Sets the value of a specified parameter to the content of a supplied InputStream, which has a specified number of bytes. |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream theInputStream,
int length)
Sets the value of a specified parameter to the content of a supplied binary InputStream, which has a specified number of bytes. |
void |
setBlob(int parameterIndex,
Blob theBlob)
Sets the value of a specified parameter to the given Blob object. |
void |
setBoolean(int parameterIndex,
boolean theBoolean)
Sets the value of a specified parameter to a supplied boolean value. |
void |
setByte(int parameterIndex,
byte theByte)
Sets the value of a specified parameter to a supplied byte value. |
void |
setBytes(int parameterIndex,
byte[] theBytes)
Sets the value of a specified parameter to a supplied array of bytes. |
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader,
int length)
Sets the value of a specified parameter to the character content of a Reader object, with the specified length of character data. |
void |
setClob(int parameterIndex,
Clob theClob)
Sets the value of a specified parameter to the given Clob object. |
void |
setDate(int parameterIndex,
Date theDate)
Sets the value of a specified parameter to a supplied java.sql.Date value. |
void |
setDate(int parameterIndex,
Date theDate,
java.util.Calendar cal)
Sets the value of a specified parameter to a supplied java.sql.Date value, using a supplied Calendar to map the Date. |
void |
setDouble(int parameterIndex,
double theDouble)
Sets the value of a specified parameter to a supplied double value. |
void |
setFloat(int parameterIndex,
float theFloat)
Sets the value of a specified parameter to to a supplied float value. |
void |
setInt(int parameterIndex,
int theInt)
Sets the value of a specified parameter to a supplied int value. |
void |
setLong(int parameterIndex,
long theLong)
Sets the value of a specified parameter to a supplied long value. |
void |
setNull(int parameterIndex,
int sqlType)
Sets the value of a specified parameter to SQL NULL. |
void |
setNull(int paramIndex,
int sqlType,
java.lang.String typeName)
Sets the value of a specified parameter to SQL NULL. |
void |
setObject(int parameterIndex,
java.lang.Object theObject)
Sets the value of a specified parameter using a supplied object. |
void |
setObject(int parameterIndex,
java.lang.Object theObject,
int targetSqlType)
Sets the value of a specified parameter. |
void |
setObject(int parameterIndex,
java.lang.Object theObject,
int targetSqlType,
int scale)
Sets the value of a specified parameter. |
void |
setRef(int parameterIndex,
Ref theRef)
Sets the value of a specified parameter to a supplied REF( |
void |
setShort(int parameterIndex,
short theShort)
Sets the value of a specified parameter to a supplied short value. |
void |
setString(int parameterIndex,
java.lang.String theString)
Sets the value of a specified parameter to a supplied String. |
void |
setTime(int parameterIndex,
Time theTime)
Sets the value of a specified parameter to a supplied java.sql.Time value. |
void |
setTime(int parameterIndex,
Time theTime,
java.util.Calendar cal)
Sets the value of a specified parameter to a supplied java.sql.Time value, using a supplied Calendar. |
void |
setTimestamp(int parameterIndex,
Timestamp theTimestamp)
Sets the value of a specified parameter to a supplied java.sql.Timestamp value. |
void |
setTimestamp(int parameterIndex,
Timestamp theTimestamp,
java.util.Calendar cal)
Sets the value of a specified parameter to a supplied java.sql.Timestamp value, using the supplied Calendar. |
void |
setUnicodeStream(int parameterIndex,
java.io.InputStream theInputStream,
int length)
Deprecated. Sets the value of a specified parameter to the characters from a supplied InputStream, with a specified number of bytes. |
Methods inherited from interface oracle.adfnmc.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 |
Method Detail |
---|
void addBatch() throws SQLException
SQLException
- if a database error happensvoid clearParameters() throws SQLException
Typically, parameter values are retained for multiple executions of the Statement. Setting a parameter value replaces the previous value. This method clears the values for all parameters, releasing all resources used by those parameters.
SQLException
- if a database error happensboolean execute() throws SQLException
A PreparedStatement may return multiple results. The execute method returns a flag indicating the kind of result
produced by PreparedStatement. The methods
getResultSet
or getUpdateCount
are used to retrieve
the first result, while getMoreResults
must be used to retrieve the second and subsequent results.
SQLException
- if a database error happensResultSet executeQuery() throws SQLException
SQLException
- if a database error happens or if the SQL statement does not produce a ResultSet.int executeUpdate() throws SQLException
SQLException
- if a database error happens or if the SQL statement returns a ResultSet.ResultSetMetaData getMetaData() throws SQLException
It is possible to know the Metadata for the ResultSet without executing the PreparedStatement, because the PreparedStatement is precompiled. As a result the Metadata can be queried ahead of time without actually executing the statement.
SQLException
- if there is a database errorParameterMetaData getParameterMetaData() throws SQLException
SQLException
- if a database error happensvoid setArray(int parameterIndex, Array theArray) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theArray
- a java.sql.Array holing the data to set.
SQLException
- if a database error happensvoid setAsciiStream(int parameterIndex, java.io.InputStream theInputStream, int length) throws SQLException
This is a good method for setting an SQL LONVARCHAR parameter where the length of the data is large. Data is read from the InputStream until end-of-file is reached or the specified number of bytes is copied.
parameterIndex
- the parameter number index, where the first parameter has index 1theInputStream
- the ASCII InputStream carrying the data to update the parameterlength
- the number of bytes in the InputStream to copy to the parameter
SQLException
- if a database error happensvoid setBinaryStream(int parameterIndex, java.io.InputStream theInputStream, int length) throws SQLException
Use this method when a large amount of data needs to be set into a LONGVARBINARY parameter.
parameterIndex
- the parameter number index, where the first parameter has index 1theInputStream
- the binary InputStream carrying the data to update the parameterlength
- the number of bytes in the InputStream to copy to the parameter
SQLException
- if a database error happensvoid setBlob(int parameterIndex, Blob theBlob) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theBlob
- a java.sql.Blob holding the data to update the parameter
SQLException
- if a database error happensvoid setBoolean(int parameterIndex, boolean theBoolean) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theBoolean
- the boolean value to update the parameter
SQLException
- if a database error happensvoid setByte(int parameterIndex, byte theByte) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theByte
- the byte value to update the parameter
SQLException
- if a database error happensvoid setBytes(int parameterIndex, byte[] theBytes) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theBytes
- the array of bytes to update the parameter
SQLException
- if a database error happensvoid setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1reader
- the java.io.Reader encompassing the character datalength
- the amount of characters to be read
SQLException
- if a database error happensvoid setClob(int parameterIndex, Clob theClob) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theClob
- a java.sql.Clob holding the data to update the parameter
SQLException
- if a database error happensvoid setDate(int parameterIndex, Date theDate) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theDate
- a java.sql.Date to update the parameter
SQLException
- if a database error happensvoid setDate(int parameterIndex, Date theDate, java.util.Calendar cal) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theDate
- a java.sql.Date to update the parametercal
- a Calendar to use to construct the SQL DATE value
SQLException
- if a database error happensvoid setDouble(int parameterIndex, double theDouble) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theDouble
- the double value to update the parameter
SQLException
- if a database error happensvoid setFloat(int parameterIndex, float theFloat) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theFloat
- the float value to update the parameter
SQLException
- if a database error happensvoid setInt(int parameterIndex, int theInt) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theInt
- the int value to update the parameter
SQLException
- if a database error happensvoid setLong(int parameterIndex, long theLong) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theLong
- the long value to update the parameter
SQLException
- if a database error happensvoid setNull(int parameterIndex, int sqlType) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1sqlType
- the SQL Type of the parameter, as defined in java.sql.Types
SQLException
- if a database error happensvoid setNull(int paramIndex, int sqlType, java.lang.String typeName) throws SQLException
Applications must provide the SQL Type code and also a fully qualified SQL Type name when supplying a NULL UDT or REF. For a UDT, the type name is the type name of the parameter itself, but for a REF parameter the type name is the type name of the referenced type.
paramIndex
- the parameter number index, where the first parameter has index 1sqlType
- the SQL Type of the parameter, as defined in java.sql.TypestypeName
- the fully qualified name of a UDT or REF type - ignored if the parameter is not a UDT.
SQLException
- if a database error happensvoid setObject(int parameterIndex, java.lang.Object theObject) throws SQLException
There is a standard mapping from Java types to SQL types, defined in the JDBC specification. The passed object is
then transformed into the appropriate SQL type, and then transferred to the database. setObject can be used to pass
abstract data types unique to the database, by using a JDBC driver specific Java type. If the object's class
implements the interface SQLData, the JDBC driver calls SQLData.writeSQL
to write it to the SQL data
stream. If the object's class implements Ref, Blob, Clob, Struct, or Array, the driver passes it to the database as
a value of the corresponding SQL type.
parameterIndex
- the parameter number index, where the first parameter has index 1theObject
- the Object containing the value to update the parameter
SQLException
- if a database error happensvoid setObject(int parameterIndex, java.lang.Object theObject, int targetSqlType) throws SQLException
The Object is converted to the target SQL type before it is added to the database. If the Object is an instance of SQLData then SQLData.writeSQL is called to write out its data.
parameterIndex
- the parameter index, where the first parameter has index 1theObject
- the Object containing the value to update the parametertargetSqlType
- the SQL Type to send to the database, as defined in java.sql.Types
SQLException
- if a database error happensvoid setObject(int parameterIndex, java.lang.Object theObject, int targetSqlType, int scale) throws SQLException
The Object is converted to the target SQL type before it is added to the database. If the Object is an instance of SQLData then SQLData.writeSQL is called to write out its data.
parameterIndex
- the parameter index, where the first parameter has index 1theObject
- the Object containing the value to update the parametertargetSqlType
- the SQL Type to send to the database, as defined in java.sql.Typesscale
- the number of decimal places if the types is java.sql.Types.DECIMAL or java.sql.Types.NUMERIC
SQLException
- if a database error happensvoid setRef(int parameterIndex, Ref theRef) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theRef
- a java.sql.Ref value to update the parameter
SQLException
- if a database error happensvoid setShort(int parameterIndex, short theShort) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theShort
- a short value to update the parameter
SQLException
- if a database error happensvoid setString(int parameterIndex, java.lang.String theString) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theString
- a String value to update the parameter
SQLException
- if a database error happensvoid setTime(int parameterIndex, Time theTime) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theTime
- a java.sql.Time value to update the parameter
SQLException
- if a database error happensvoid setTime(int parameterIndex, Time theTime, java.util.Calendar cal) throws SQLException
The driver uses the supplied Calendar to create the SQL TIME value, which allows it to use a custom timezone - otherwise the driver uses the default timezone of the Java virtual machine.
parameterIndex
- the parameter number index, where the first parameter has index 1theTime
- a java.sql.Time value to update the parametercal
- a Calendar to use to construct the SQL TIME value
SQLException
- if a database error happensvoid setTimestamp(int parameterIndex, Timestamp theTimestamp) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theTimestamp
- the java.sql.Timestamp value to update the parameter
SQLException
- if a database error happensvoid setTimestamp(int parameterIndex, Timestamp theTimestamp, java.util.Calendar cal) throws SQLException
The driver uses the supplied Calendar to create the SQL TIMESTAMP value, which allows it to use a custom timezone - otherwise the driver uses the default timezone of the Java virtual machine.
parameterIndex
- the parameter number index, where the first parameter has index 1theTimestamp
- the java.sql.Timestamp value to update the parametercal
- a Calendar to use to construct the SQL TIMESTAMP value
SQLException
- if a database error happensvoid setUnicodeStream(int parameterIndex, java.io.InputStream theInputStream, int length) throws SQLException
parameterIndex
- the parameter number index, where the first parameter has index 1theInputStream
- the InputStream with the character data to update the parameterlength
- the number of bytes to read from the InputStream
SQLException
- if a database error happens
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |