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
posted 14 years ago
UPDATE user_hits SET hits = hits + 1 WHERE user_id = ? Use a PreparedStatement for this so the database can cache it. - Peter