aspose file tools*
The moose likes JDBC and the fly likes increment a number in a column? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "increment a number in a column?" Watch "increment a number in a column?" New topic
Author

increment a number in a column?

davy nolan
Greenhorn

Joined: Mar 20, 2001
Posts: 6
Hello,
Just wondering what would be the best way to increment a number in a column in a database.The situation is that the database must record the number of hits a user makes to the site. So I must retrieve the number for the particular row for that user and increment it each time they logon to the site. Is there any one liner way of doing this? I am using the Oracle 9i database and the userid is the primary key for each row.

Cheers,
Davy Nolan
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
UPDATE user_hits SET hits = hits + 1 WHERE user_id = ?
Use a PreparedStatement for this so the database can cache it.
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: increment a number in a column?
 
Similar Threads
Size of the arraylist different after deleting the record?
GUI question
Record Locking in multi-user
Regarding Jtable row Deletion
making a JTable column not visible