| Author |
about executeUpdate
|
jerry chi
Greenhorn
Joined: Oct 21, 2004
Posts: 3
|
|
hi i want to insert a record into table with PreparedStatement.executeUpdate function. when does it return 0 whithout an SQLException occured? thanks
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
|
can you provide code snippet ???
|
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by Shailesh Chandra: can you provide code snippet ???
why you need a code snippet Chandra. Jerry you should read the docs for this question, what you think?
|
 |
Shailesh Chandra
Ranch Hand
Joined: Aug 13, 2004
Posts: 1076
|
|
Originally posted by adeel ansari: why you need a code snippet Chandra.
I have never come across a scenario when there is no insert ,also there is no exception. so just wanted to verify code
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26141
|
|
This can happen if you do an insert based on values from another table. If the select doesn't return any rows, you are inserting zero rows into a table. There isn't an exception because you aren't violating any constraints.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
jerry chi
Greenhorn
Joined: Oct 21, 2004
Posts: 3
|
|
thank you Jeanne i think there is no other case than what you said. if i just insert a record whithout select clause, i needn't judge whether the function returns zero. is that right.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26141
|
|
Jerry, I think that is right. All the other reasons for failure that I can think of would thow an exception.
|
 |
 |
|
|
subject: about executeUpdate
|
|
|