
USE fetchmetrics;

DROP PROCEDURE IF EXISTS fetchmetrics.p_dog_clear_calc_role;
DROP PROCEDURE IF EXISTS fetchmetrics.p_role_clear_calc_role;

DELIMITER //
CREATE PROCEDURE fetchmetrics.p_dog_clear_calc_role (
	  IN a_guid BINARY(36)
    , IN a_debug BIT
)
BEGIN
	DECLARE v_time_start TIMESTAMP(6);
    SET v_time_start := CURRENT_TIMESTAMP(6);
    
    CALL fetchmetrics.p_core_validate_guid ( a_guid );
    
	START TRANSACTION;
		
		DELETE ROLE_T
        FROM fetchmetrics.DOG_Role_Temp ROLE_T
		WHERE ROLE_T.GUID = a_guid
		;
		
	COMMIT;
    
    IF a_debug = 1 THEN
		CALL fetchmetrics.p_debug_timing_reporting( v_time_start );
    END IF;
END //
DELIMITER ;

/*

CALL fetchmetrics.p_dog_clear_calc_role (
	'crips                               ' -- a_guid
    , 1 -- debug
);

SELECT *
FROM fetchmetrics.DOG_Calc_User_Access_Temp
WHERE GUID = 'chips                               '
;

*/
