Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Difference between execute() and executeUpdate() for Procedures

843859Sep 8 2006 — edited Sep 8 2006
Hi,

I am trying to understand the differences between the execute() and the executeUpdate() methods of the java.sql.PreparedStatement.

I am using a CallableStatement to call a Stored Procedure in Oracle. I have tired using the execute() and the executeUpdate() methods and both of them work. Howeer, execute() returns a boolean & executeUpdate() returns an integer.

I am unable to understand the return value of executeUpdate() - if I call a procedure that simply returns a ResultSet in an OUT Parameter, executeUpdate() returns 1. However, the JavaDoc for executeUpdate() states that it :-
Returns:
    either (1) the row count for INSERT, UPDATE, or DELETE statements or (2) 0 for SQL statements that return nothing
I am a little confued with the output.

Can you guys please explain the difference to me ?

Regards,

Sandeep
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2006
Added on Sep 8 2006
2 comments
1,370 views