I created trigger on table PENDING. Pending table has 3 columns - uniqueId , duration and maxDuration. I have another table COUNT with 2 columns - req_id, total
Here is my trigger--
CREATE TRIGGER plus3second BEFORE INSERT
ON PENDING
FOR EACH ROW
BEGIN
DECLARE req_id varchar(25);
DECLARE total int(11);
DECLARE duration int(2);
SET req_id = SUBSTR(new.uniqueId, 1, 14);
Select total into total from COUNT where req_id = 'req_id';
IF total > 100 THEN
SET duration = new.duration + 3;
IF duration < new.maxDuration Then
SET new.duration = duration;
END IF;
END IF;
END
Trigger created successfully. I fired these queries on COUNT and PENDING-
insert into COUNT values ('77711422099653',200);
insert into PENDING (uniqueId, duration, maxDuration) values ('77711422099653919893277163', 3, 20);
But trigger not working ...Where is the problem ?