From ab846658ba379aff5ff2ea85bf228ecb192871b7 Mon Sep 17 00:00:00 2001 From: Alpha2J <3287566354@qq.com> Date: Mon, 7 May 2018 10:25:45 +0800 Subject: [PATCH] Update SQL.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mysql 5.7.18 中, 触发器不允许返回结果集. --- notes/SQL.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/notes/SQL.md b/notes/SQL.md index 2eb67e58..2e99db4e 100644 --- a/notes/SQL.md +++ b/notes/SQL.md @@ -603,7 +603,10 @@ INSERT 触发器包含一个名为 NEW 的虚拟表。 ```sql CREATE TRIGGER mytrigger AFTER INSERT ON mytable -FOR EACH ROW SELECT NEW.col; +FOR EACH ROW SELECT NEW.col into @result; + +-- 获取结果 +SELECT @result; ``` DELETE 触发器包含一个名为 OLD 的虚拟表,并且是只读的。