3 like 0 dislike
862 views
in Education & Reference by (1.4k points)

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 ;

1 Answer

0 like 0 dislike
by (640 points)
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?

Related questions

2 like 0 dislike
3 answers 17k views
0 like 0 dislike
1 answer 972 views
0 like 0 dislike
1 answer 1.4k views
0 like 0 dislike
1 answer 174 views
0 like 0 dislike
1 answer 219 views
0 like 0 dislike
1 answer 572 views
0 like 0 dislike
1 answer 536 views
1 like 0 dislike
1 answer 55 views
1 like 0 dislike
1 answer 75 views

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

...