MySQL Forums
Forum List  »  Stored Procedures

Re: Get the code and description of an error within a stored procedure
Posted by: Claudinei Silva
Date: November 01, 2017 10:17PM

Peter Brawley / Group

Your idea is even good, but unfortunately I am using the version of MySQL 5.5.20, as I commented in the beginning of my message.
More what I was really looking for would be similar to this but in the version of MySQL 5.5.20 how to do similar to the below, example (1) or (2) ?
Or do when using the commands below, example (3)


1)
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
@errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SELECT @sqlstate, @errno, @text;


2)
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
@errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
SELECT @full_error;
END;

3)
MYSQL_ERRNO ou RETURNED_SQLSTATE ou MESSAGE_TEXT

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Get the code and description of an error within a stored procedure
1790
November 01, 2017 10:17PM


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.