ROLL Back to the save point : TRANSACTION ROLLBACK « Transaction « SQL / MySQL






ROLL Back to the save point

Drop table Books;


CREATE TABLE Books
(
   ID SMALLINT NOT NULL PRIMARY KEY,
   Title VARCHAR(60) NOT NULL,
   Copyright YEAR NOT NULL
)
ENGINE=INNODB;


select * from Books;

START TRANSACTION;
INSERT INTO Books VALUES (103, 'Angels', 1966);
INSERT INTO Books VALUES (104, 'Black', 1932);
SAVEPOINT sp1;
INSERT INTO Books VALUES (105, 'None', 1996);
INSERT INTO Books VALUES (106, 'A', 1980);
ROLLBACK TO SAVEPOINT sp1;
INSERT INTO Books VALUES (107, 'Postcards', 1992);
INSERT INTO Books VALUES (108, 'The', 1993);
COMMIT;

select * from Books;

           
       








Related examples in the same category

1.TRANSACTION and ROLLBACK
2.TRANSACTION and save point