关于触发器发生MySQL错误

时间:2016-10-04 03:21:26

标签: mysql

MySQL的版本是5.5。

我有一个名为“orders”的表:

CREATE TABLE orders
(
  order_num  INT      NOT NULL AUTO_INCREMENT,
  order_date DATETIME NOT NULL ,
  cust_id    INT      NOT NULL ,
  PRIMARY KEY (order_num)
) ENGINE=INNODB;

我有一些数据:

INSERT INTO orders(order_num, order_date, cust_id)
VALUES(20005, '2005-09-01', 10001);
INSERT INTO orders(order_num, order_date, cust_id)
VALUES(20006, '2005-09-12', 10003);
INSERT INTO orders(order_num, order_date, cust_id)
VALUES(20007, '2005-09-30', 10004);
INSERT INTO orders(order_num, order_date, cust_id)
VALUES(20008, '2005-10-03', 10005);
INSERT INTO orders(order_num, order_date, cust_id)
VALUES(20009, '2005-10-08', 10001);

现在我创建一个触发器:

CREATE TRIGGER neworder AFTER INSERT ON orders FOR EACH ROW SELECT NEW.order_num;

但它会出错:

  

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

为什么?

0 个答案:

没有答案