MySQL Forums
Forum List  »  InnoDB

Re: transaction not work for trigger table
Posted by: William Chiquito
Date: June 27, 2008 11:56AM

Hi kilin,

Try:
CREATE TABLE `t1` (
  `id` int(11) default NULL,
  `fecha` datetime default NULL
) ENGINE=InnoDB;

CREATE TABLE `t2` (
  `id` int(11) default NULL,
  `fecha` datetime default NULL
) ENGINE=InnoDB;

DELIMITER $$

CREATE TRIGGER `trgaitestt1` AFTER INSERT ON `t1`
FOR EACH ROW
BEGIN
	INSERT INTO t2 VALUES (NEW.id, NEW.fecha);
END$$

DELIMITER ;

START TRANSACTION;
INSERT INTO t1 VALUES (1, NOW()), (2, NOW()), (3, NOW()), (4, NOW());
ROLLBACK;

SELECT * FROM t1;

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: transaction not work for trigger table
2820
June 27, 2008 11:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.