This week's book giveaway is in the
We're giving away four copies of a choice of
"Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac"
and have Joe Kissell on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Take Control of Upgrading to Yosemite
Take Control of Automating Your Mac
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
subject: Insert or Update using prepared statement in java
ORA-01460: unimplemented or unreasonable conversion requested
SQL Database Structure
Adding a record to a database-new to JDBC
How can i tell if a resultset is empty?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014