So I was trying to solve a reported error in a Stored Procedure and was receiving very strange results; the EXCEPTION details never lined up even when I did an EXECUTE (without debug). So I deleted the cr_debug database and tried to simply EXECUTE the stored procedure, and received the below error:
Code: Select all
FUNCTION cr_debug.ENTER_MODULE2 does not exist.
I then went back to dbForge and recompiled the stored procedure (not for debug, but just compile) and everything worked just fine.
So the core issue is the debug compiled version of the stored procedure was returning incorrect SQLEXCEPTION error information; it seems the debug compile is interfering with that - which is a big problem. Note the below is the exception handling code:
Code: Select all
-- == [ERROR HANDLING] ========================================
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS @sp_error_count = NUMBER;
GET DIAGNOSTICS CONDITION @sp_error_count @sp_error_state = RETURNED_SQLSTATE,
@sp_error_number = MYSQL_ERRNO, @sp_error_message = MESSAGE_TEXT;
SELECT @sp_error_count;
ROLLBACK; SET out_result = FALSE;
CALL internal_error_handler(JSON_OBJECT('source','SQL','type','exit','location',debug_location),
NULL, debug_details, out_result_details);
END;