Fun at zangOOr Click Here
3 like 0 dislike
897 views

Value is not coming in @id as how to concat id variable in query

DELIMITER $$

CREATE TRIGGER update_trigger
AFTER INSERT ON asterisk.queue_log
FOR EACH ROW
BEGIN


 SET @id = (select callid from asterisk.queue_log where event="TRANSFER" and callid=(select callid from asterisk.queue_log
order by id desc limit 1));

SET @agentid = (select agent from asterisk.queue_log where event="TRANSFER" and callid=(select callid from
asterisk.queue_log order by id desc limit 1));

update Feedback.Feedback_Data set [email protected] where [email protected];

END $$
DELIMITER ;
in Education & Reference by (1.4k points) | 897 views

1 Answer

0 like 0 dislike
There are two methods, first you can run trigger like below

DELIMITER $$
    CREATE TRIGGER Feedback
    AFTER INSERT ON queue_log
    FOR EACH ROW
    BEGIN
    DECLARE v_id varchar(32);
    DECLARE v_agentid varchar(32);
    SELECT callid, agent INTO v_id, v_agentid
    FROM queue_log
    WHERE event="TRANSFER"
    ORDER BY id desc limit 1;

    update Feedback_Data set Agent_Id=v_agentid where Call_Id=v_id;

    END $$
 DELIMITER ;

 

And the other method is calling external program and do what you want below is the way

http://answergig.com/798/how-to-execute-call-an-external-program-from-mysql-trigger?
by (640 points)

Related questions

2 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jul 25, 2013 in Education & Reference by Marc (3.3k points) | 579 views
0 like 0 dislike
1 answer
2 like 0 dislike
1 answer
1 like 0 dislike
1 answer

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,243 questions
1,398 answers
564 comments
3,459 users