2016-11-28 91 views
0

我創建了一個觸發的結果集,我沒有設置任何返回值,但有跡象表明不允許返回從觸發

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 ; 

回答

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; 
相關問題