A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
Insert or Update using prepared statement in java
Joined: Jun 14, 2009
Apr 19, 2011 09:01:58
Hi, I am a newbee in Java.
What I want to do in my program is to
1) insert a new row in case the row doesn't exist OR
2) Update the row if the row exists
I checked the api and didn't find anything
Joined: Oct 14, 2005
Apr 19, 2011 09:55:53
SELECT from TABLE where (keys specify the row) If ResultSet has zero records: INSERT else UPDATE
Unless of course your database has an "UPDATE-IF-ROW-EXISTS-ELSE-INSERT" command in its version of SQL. (Most of them don't.) But this would be a question about your database, rather than about
Joined: Feb 22, 2011
Apr 19, 2011 11:33:11
If you are using Oracle as your DB, you can use
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: Insert or Update using prepared statement in java
How can i tell if a resultset is empty?
Adding a record to a database-new to JDBC
SQL Database Structure
ORA-01460: unimplemented or unreasonable conversion requested
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014