不允许从触发器

时间:2016-11-28 12:47:15

标签: mysql

我创建了一个触发器,但我没有设置任何返回值但显示错误

    DELIMITER //
    CREATE TRIGGER Trig_InsertIBDActionURL  AFTER INSERT ON tbl_ibdcalllog FOR EACH ROW
    BEGIN
      DECLARE ActionURL varchar(500);
       select @ActionURL := trim(`actionurl`) from tbl_client where id=NEW.clientid;
         if(CHAR_LENGTH(ActionURL) <> 0) THEN
                    insert into tbl_ibdactionurl (Call_id,clientid,mobile_number,language,call_starttime,call_duration,keypress,file_name,obd_status,
    operator,circle,failure_reason,smsflag,datacapture,latch_duration,latchcreditused,creditused,country_code,callcenter_no,ActionURL)
            (select id,clientid,mobile_number,language,call_starttime,call_duration,keypress,file_name,obd_status,operator,circle,failure_reason,
    smsflag,datacapture,latch_duration,latchcreditused,creditused,country_code,callcenter_no, @ActionURL from tbl_ibdcalllog where id = NEW.id);
          END IF;
    END;//

DELIMITER ;

1 个答案:

答案 0 :(得分:0)

我认为你的insert into .. select from是罪魁祸首。通过删除()语句周围的SELECT来更改它(可能会让您感觉到您正在尝试返回结果集)并查看它是否已关闭

insert into tbl_ibdactionurl  
(Call_id,clientid,mobile_number,language,call_starttime,
 call_duration,keypress,file_name,obd_status,   
operator,circle,failure_reason,smsflag,datacapture,latch_duration,
latchcreditused,creditused,country_code,callcenter_no,ActionURL)
select id,clientid,mobile_number,language,call_starttime,call_duration,
keypress,file_name,obd_status,operator,circle,failure_reason,   
smsflag,datacapture,latch_duration,latchcreditused,creditused,
country_code,callcenter_no, @ActionURL 
from tbl_ibdcalllog 
where id = NEW.id;