截断触发器内的两个表的解决方法

时间:2014-08-14 19:24:46

标签: mysql

我的数据库中有一个触发器

DELIMITER //
CREATE TRIGGER `the_permit` AFTER INSERT ON `messagein` FOR EACH ROW BEGIN
declare le_center_number VARCHAR(100) DEFAULT '0800100200';
declare le_answer VARCHAR(100) DEFAULT '0800100200';
declare last_inserted_text VARCHAR(100) DEFAULT '0800100200';
declare messageout_count VARCHAR(100) DEFAULT '0800100200';
declare messagelog_count VARCHAR(100) DEFAULT '0800100200';

set le_center_number = (select center_number from center_number limit 1);
set le_answer = NEW.messagetext;
set messageout_count = (SELECT COUNT(*) FROM messageout);
set messagelog_count = (SELECT COUNT(*) FROM messagelog);

......

delete * from messageout;
delete * from messagelog;

END //
DELIMITER ;

我需要截断两个表。但是在触发器内截断会引发错误

Error: Explicit or implicit commit is not allowed in stored function or trigger.当我尝试

delete * from messageout;
delete * from messagelog;

我收到此错误......right syntax to use near '* from messageout;

触发器中是否也不允许delete * from messageout;

0 个答案:

没有答案