Share via


Statement.execute

Interface Overview | Interface Members | This Package | All Packages

Syntax

public abstract boolean execute( String sql ) throws SQLException

Parameters
  • sql
    any SQL statement
Returns

true if the next result is a ResultSet; false if it is an update count or there are no more results

Description

Execute a SQL statement that may return multiple results. Under some (uncommon) situations a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this, unless you're executing a stored procedure that you know may return multiple results, or unless you're dynamically executing an unknown SQL string. The "execute", "getMoreResults", "getResultSet" and "getUpdateCount" methods let you navigate through multiple results. The "execute" method executes a SQL statement and indicates the form of the first result. You can then use getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s).

Exceptions

SQLException if a database-access error occurs.

See Also

getResultSet, getUpdateCount, getMoreResults