Statement
interface provides number of methods to execute sql statement.
Method
|
Description
|
boolean
execute(String sql)
|
Executes the given
SQL statement, which may return multiple results.
|
boolean
execute(String sql, int autoGeneratedKeys)
|
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(String sql, int[] columnIndexes)
|
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(String sql, String[] columnNames)
|
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()
|
Submits a batch of
commands to the database for execution and if all commands execute
successfully, returns an array of update counts.
|
long[]
executeLargeBatch()
|
Submits a batch of
commands to the database for execution and if all commands execute
successfully, returns an array of update counts.
|
long
executeLargeUpdate(String sql)
|
Executes the given
SQL statement, which may be an INSERT, UPDATE, or DELETE statement
or an SQL statement that returns nothing, such as an SQL DDL
statement.
|
long
executeLargeUpdate(String sql, int autoGeneratedKeys)
|
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.
|
long
executeLargeUpdate(String sql, int[] columnIndexes)
|
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.
|
long
executeLargeUpdate(String sql, String[] columnNames)
|
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.
|
ResultSet
executeQuery(String sql)
|
Executes the given
SQL statement, which returns a single ResultSet object.
|
int
executeUpdate(String sql)
|
Executes the given
SQL statement, which may be an INSERT, UPDATE, or DELETE statement
or an SQL statement that returns nothing, such as an SQL DDL
statement.
|
int
executeUpdate(String sql, int autoGeneratedKeys)
|
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(String sql, int[] columnIndexes)
|
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(String sql, String[] columnNames)
|
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.
|
Note
If
a method does not return a ResultSet object explicitly, then you can
call the Statement.getResultSet() method to get the ResultSet object.
No comments:
Post a Comment