I'm trying to do a simple transaction in MySQL
delimiter go
start transaction;
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND ROLLBACK;
INSERT INTO jext_categories (Na开发者_如何转开发me) VALUES ('asdfas');
INSERT INTO jext_categories (Name) VALUES ('asdfas2');
END;
commit;
SELECT * FROM jext_categories;
go
delimiter ;
but I keep getting an error saying query was empty. Could someone please tell me what I am doing wrong, and also, what is the proper format for doing a transaction in MySQL?
Thanks!
DECLARE is supported only in stored routines
精彩评论