This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Statement functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Statement functions" Watch "Statement functions" New topic

Statement functions

Joe Wolf
Ranch Hand

Joined: Jul 05, 2001
Posts: 42
If you want to issue a CREATE, DROP or ALTER command in SQL, which function should you call on your Statement: executeQuery(), executeUpdate(), or execute()?
Robert Brunner
Ranch Hand

Joined: Jul 18, 2001
Posts: 49
executeUpdate, as you are doing SQL DDL statements. You should get zero rows returned in the update count.
krishnan sampath

Joined: Aug 08, 2001
Posts: 3
If you want to execute a DDL statement from java, it is enough to run a stored procedure.. In the stored procedure use execute_immediate (for 8i and above) for executing the DDL statements.
If your oracle version 8 and use
DBMS_SQL.EXECUTE, for executing DDL statements
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Statement functions