触发问题 [英] Problem in trigger

查看:76
本文介绍了触发问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是Trigger的新手。我写这个触发器以这种方式将一个表的总行数插入到另一个表中


创建触发器count_row

插入main_table后

每行开始

INSERT INTO row_count_table(after_insert)(SELECT COUNT(*)FROM main_table);


我不知道当我试图用END结束这个陈述时,这句话有什么不对;还有。

Hi

I am new to Trigger. I write trigger to insert total no.of row of a table to another table in this way

CREATE TRIGGER count_row
AFTER INSERT ON main_table
FOR EACH ROW BEGIN
INSERT INTO row_count_table (after_insert) (SELECT COUNT(*) FROM main_table);

I don''t know what is the wrong in this statement while I tried to end this statement with END; also.

推荐答案





我是Trigger的新手。我写这个触发器以这种方式将一个表的总行数插入到另一个表中


创建触发器count_row

插入main_table后

每行开始

INSERT INTO row_count_table(after_insert)(SELECT COUNT(*)FROM main_table);


我不知道当我试图用END结束这个陈述时,这句话有什么不对;也。
Hi

I am new to Trigger. I write trigger to insert total no.of row of a table to another table in this way

CREATE TRIGGER count_row
AFTER INSERT ON main_table
FOR EACH ROW BEGIN
INSERT INTO row_count_table (after_insert) (SELECT COUNT(*) FROM main_table);

I don''t know what is the wrong in this statement while I tried to end this statement with END; also.


那里你去。


试试这个:

Try this:

展开 | 选择 | 换行 | 行号



试试这个:


DELIMITER
Try this:

DELIMITER


这篇关于触发问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆