MySQL Forums
Forum List  »  MySQL Workbench

Re: Every Attempt at Error Handling Fails with GET statement
Posted by: Peter Brawley
Date: December 02, 2019 12:23PM

Missing some bits ...

CREATE PROCEDURE routine1()
BEGIN
  DECLARE exit handler for SQLEXCEPTION
    BEGIN
      GET DIAGNOSTICS CONDITION 1
          @sqlstate = RETURNED_SQLSTATE,
          @errno = MYSQL_ERRNO, 
          @text = MESSAGE_TEXT;
      SET @full_error = 
        CONCAT("SQL Exception:act_account_main_create:", @errno, " (", @sqlstate, "): ", @text);
      SELECT @full_error;
    END;
END;

Options: ReplyQuote




Sorry, only registered users may post in this forum.

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.