problem with trigger update
Posted by: mitch reward
Date: March 20, 2015 05:13AM

HELLO all,

I've a table :
+-------+--------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+-------------------+----------------+
| id | int(9) | NO | PRI | NULL | auto_increment |
| user | varchar(255) | NO | | NULL | |
| when | timestamp | NO | | CURRENT_TIMESTAMP | |
| count | int(5) | NO | | NULL | |
| state | int(1) | NO | | NULL | |
+-------+--------------+------+-----+-------------------+----------------+

where USER field must be uniq. So I managed to not have a mutiple same user;
I do a : insert ignore into mailcount (user, state) values ('xxxx','1');

After my need who be to increment the count column if the user already exist on insert. I tried with a trigger UPDATE (after insert) but this is not working. I guess that's because the insert does cant succeed.

Any suggestion? I can set tables, triggers how I want but I have a perfomance constraint (~10 inserts by second).

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
problem with trigger update
March 20, 2015 05:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.