
USE partsltd_prod;

DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_clear_calc_user;

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

/*

CALL partsltd_prod.p_ph_clear_calc_user (
	'chips                               ' -- a_guid
    , 1 -- debug
);

SELECT *
FROM partsltd_prod.PH_Calc_User_Temp
WHERE GUID = 'chips                               '
;

*/
