Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3724

Every Attempt at Error Handling Fails with GET statement (5 replies)

$
0
0
I'm using MySQL 8.x and every attempt at putting any error handling that provides internal details fails on the 'GET' (red highlight) stating:

"GET is not valid at this position"

Yet all of this code is all over the internet. Note this happens with any error handling code that has the keyword 'GET' in it, and the code works just fine in dbfiddle.

If I put in the following, it all works fine (because there is no 'GET') - but this doesn't provide the actual error message the system is producing:

DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SELECT 'SQL Exception:act_account_main_verify' Message; END;

Just this code alone causes the error as well; an empty routine with nothing but the error handler in it:

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

I tried using locally 'DECLARE'd variables, instead of user '@variable's, for assignment in 'GET DIAGNOSTICS'. No difference.

I'm running the latest version of the Workbench Editor and MySQL Local CE Server (latest version).

I wonder if there's some core SQL setting that enables a 'GET' within a 'SQLEXCEPTION' that perhaps isn't enabled? Or is it because I'm using CE vs. SE?

Viewing all articles
Browse latest Browse all 3724

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>