2024-07-22 09:52:42 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:10:46 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bi`.`clean`()
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
DECLARE vDateShort DATETIME;
|
|
|
|
DECLARE vDateLong DATETIME;
|
|
|
|
DECLARE vOneYearAgo DATETIME;
|
|
|
|
|
|
|
|
SET vDateShort = TIMESTAMPADD(MONTH, -2, util.VN_CURDATE());
|
|
|
|
SET vDateLong = TIMESTAMPADD(MONTH, -18,util.VN_CURDATE());
|
|
|
|
SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,util.VN_CURDATE());
|
|
|
|
|
|
|
|
DELETE FROM bi.Greuge_Evolution
|
|
|
|
WHERE (Fecha < vDateShort AND weekday(Fecha) != 1)
|
|
|
|
OR Fecha < vOneYearAgo;
|
|
|
|
|
|
|
|
DELETE FROM bi.defaulters WHERE `date` < vDateLong;
|
|
|
|
DELETE FROM bi.defaulting WHERE `date` < vDateLong;
|
2024-07-22 09:52:42 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|