DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`nightTask_launchTask`( vSchema VARCHAR(255), vProcedure VARCHAR(255), OUT vError VARCHAR(255), OUT vErrorCode VARCHAR(255) ) BEGIN /** * Runs an specific procedure from nightly tasks, if an error * occurs, instead of throw it, #vError and #vErrorCode variables * are setted. * * @param vSchema The procedure schema * @param vProcedure The procedure name * @param vError The error message, if any * @param vErrorCode The error code, if any */ DECLARE EXIT HANDLER FOR SQLEXCEPTION GET DIAGNOSTICS CONDITION 1 vError = MESSAGE_TEXT, vErrorCode = RETURNED_SQLSTATE; CALL util.exec(CONCAT('CALL `', vSchema ,'`.`', vProcedure ,'`')); END$$ DELIMITER ;