
USE fetchmetrics;

DROP PROCEDURE IF EXISTS fetchmetrics.p_dog_clear_calc_dog;

DELIMITER //
CREATE PROCEDURE fetchmetrics.p_dog_clear_calc_dog (
	  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 DOG_T
        FROM fetchmetrics.DOG_Dog_Temp DOG_T
		WHERE DOG_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_dog (
	'crips                               ' -- a_guid
    , 1 -- debug
);

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

*/
