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!

CallableStmt executeUpdate() method doesn't return the actual rows updated

484415Jan 20 2006 — edited Jan 24 2006
Hi,

I have an an Function in oracle which updates a table and returns back.

sample code :

BEGIN
UPDATE TEST1 SET ID=12345;
-- RETURN SQL%ROWCOUNT;
RETURN 0
END

When i use CallableStmt object in java to execute this function,
int count = ((PreparedStatement)cstmt1).executeUpdate();

the count returned is always -1 and cstmt1.getUpdateCount() returns 1
whereas the actual rows updated something different (the out param in my java code returns the exact count if i use RETURN SQL%ROWCOUNT)

The same procedures in sybase were returning the exact count with the same piece of java code.

Your help would be highly appreciated.

Thanks in advance,
Mukesh Pujari.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 21 2006
Added on Jan 20 2006
5 comments
1,439 views