MySQL Forums
Forum List  »  Stored Procedures

Re: Exit Handler for SQLEexception
Posted by: Peter Brawley
Date: May 22, 2019 09:42AM

1 Why the cursor for the deletions, why not just

delete a,b
from a join b on ...

2 Rollback is possible only in a transaction, but your sproc doesn't define one, it seems to me you need something like ...

create procedure ...
begin
  declare `_rollback` bool default 0;
  declare continue handler for sqlexception set `_rollback`=1;
  start transaction;
    delete ...;
    insert ...;
  if `_rollback` then
    rollback;
  else
    commit;
  end if;
end;

Options: ReplyQuote


Subject
Views
Written By
Posted
1835
May 22, 2019 08:45AM
Re: Exit Handler for SQLEexception
519
May 22, 2019 09:42AM


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.