我正在尝试在MySQL中执行一个简单的事务
delimiter go
start transaction;
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND ROLLBACK;
INSERT INTO jext_categories (Name) VALUES ('asdfas');
INSERT INTO jext_categories (Name) VALUES ('asdfas2');
END;
commit;
SELECT * FROM jext_categories;
go
delimiter ;
但我一直收到错误,说查询为空。有人可以告诉我我做错了什么,以及在MySQL中进行交易的正确格式是什么?
谢谢!
答案 0 :(得分:1)
仅在存储的例程中支持DECLARE