MySQL Forums
Forum List  »  Stored Procedures

Re: Error handler not being triggered for multi-table updates
Posted by: Peter Brawley
Date: August 16, 2015 09:39PM

Missing Delimiter directives. Try it this way ...

drop procedure if exists handlerdemo; 
delimiter go
CREATE PROCEDURE handlerdemo() 
BEGIN 
  DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' 
    set @msg = 'A duplicate key error has occurred'; 
  set @msg='ok';
  update t1 
  join t2 on t1.s1 = t2.s1 
  set t1.s1 = t2.s2;
  select @msg;
END; 
go
delimiter ;
CALL handlerdemo();

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Error handler not being triggered for multi-table updates
834
August 16, 2015 09:39PM


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.