execute()
Syntax:
boolean execute() throws SQLException
Description:
Executes the SQL statement in this PreparedStatement
object, which may be any kind of SQL statement. Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by the methods executeQuery
and executeUpdate
.
The execute method returns a boolean to indicate the form of the first result. You must call either the method getResultSet
or getUpdateCount
to retrieve the result; you must call getMoreResults
to move to any subsequent result(s).
Returns:
true if the first result is a ResultSet
object; false if the first result is an update count or there is no result
Throws:
SQLException - if a database access error occurs or the prepared statement has been closed
Reference:
For more information, reference JDBC documentation for: PreparedStatement.execute()