13.16. ERROR 1415: Not allowed to return a result set from a trigger
触发器中不允许返回结果集,解决方法是顶一个变量,然后将返回值返回给变量。
DROP TRIGGER IF EXISTS `test`.`demo_AFTER_INSERT`;
DELIMITER $$
USE `test`$$
CREATE DEFINER=`root`@`%` TRIGGER `test`.`demo_AFTER_INSERT` AFTER INSERT ON `demo` FOR EACH ROW
BEGIN
set @rev = "";
SELECT
OUT2FILE('/tmp/demo.log',
CONCAT_WS(',',
NEW.id,
NEW.name,
NEW.sex,
NEW.address))
INTO @rev;
END$$
DELIMITER ;
Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。