I have three tables namely ozekimessagein,ozekimessageout and troubleshooter. I want to compare the values in tables ozekimessagein & troubleshooter and then insert in to the table ozekimessageout.
If i insert the first record in to the table ozekimessagein, the trigger execute quite well but when i insert the second record, the trigger displays the following message
" MySQL said:
#1172 - Result consisted of more than one row"
Please assist me how to get out of this error because i will be posting alot of records in the table ozekimessagein
DELIMITER |
CREATE TRIGGER troubleshoot_trig AFTER INSERT ON ozekimessagein
FOR EACH ROW
BEGIN
DECLARE soln_msg varchar(160);
DECLARE phone_number varchar(13);
DECLARE prob_code varchar(5);
SELECT sender INTO phone_number FROM ozekimessagein WHERE sender = NEW.sender;
SELECT msg INTO prob_code FROM ozekimessagein WHERE msg = NEW.msg;
SELECT msg INTO soln_msg FROM troubleshooter WHERE code = prob_code;
INSERT INTO ozekimessageout(receiver, msg) VALUES(phone_number, soln_msg);
END
|
DELIMITER;
If i insert the first record in to the table ozekimessagein, the trigger execute quite well but when i insert the second record, the trigger displays the following message
" MySQL said:
#1172 - Result consisted of more than one row"
Please assist me how to get out of this error because i will be posting alot of records in the table ozekimessagein
DELIMITER |
CREATE TRIGGER troubleshoot_trig AFTER INSERT ON ozekimessagein
FOR EACH ROW
BEGIN
DECLARE soln_msg varchar(160);
DECLARE phone_number varchar(13);
DECLARE prob_code varchar(5);
SELECT sender INTO phone_number FROM ozekimessagein WHERE sender = NEW.sender;
SELECT msg INTO prob_code FROM ozekimessagein WHERE msg = NEW.msg;
SELECT msg INTO soln_msg FROM troubleshooter WHERE code = prob_code;
INSERT INTO ozekimessageout(receiver, msg) VALUES(phone_number, soln_msg);
END
|
DELIMITER;