开发者

MySQL Simple query gives "Query was empty". Transaction help needed I think

开发者 https://www.devze.com 2022-12-30 21:52 出处:网络
I\'m trying to do a simple transaction in MySQL delimiter go start transaction; BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION, SQLWARNING, NOT FOUND ROLLBACK;

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

0

精彩评论

暂无评论...
验证码 换一张
取 消