Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

increment a number in a column?  RSS feed

 
davy nolan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UPDATE user_hits SET hits = hits + 1 WHERE user_id = ?
Use a PreparedStatement for this so the database can cache it.
- Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!