gpt4 book ai didi

mysql - 不允许从触发器返回结果集

转载 作者:行者123 更新时间:2023-11-29 19:49:59 24 4
gpt4 key购买 nike

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

    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 ;

最佳答案

我认为你的 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;

关于mysql - 不允许从触发器返回结果集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40844728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com