DROP PROCEDURE IF EXISTS `stp_removeLogMachine`;

CREATE DEFINER=`steamware`@`10.74.%` PROCEDURE `stp_removeLogMachine`(
    IN `pKeyNum` INT,
    IN `pMachineID` INT,
    IN `pDtMin` DATETIME,
    IN `pDtMax` DATETIME
)
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'Rimozione in blocco record da Key+Macchina+Periodo table LogMachine'
BEGIN

    # elimino intervallo
    DELETE	
    FROM    LogMachine
    WHERE   KeyNum      = pKeyNum
        AND MachineID   = pMachineID
        AND (DtEvent >= pDtMin AND DtEvent <= pDtMax);
END