salix/db/routines/sage/procedures/clean.sql

13 lines
306 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`clean`()
BEGIN
/**
* Maintains tables over time by removing unnecessary data
*/
DECLARE vTwoYearAgo DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR;
DELETE FROM movConta WHERE FechaAsiento < vTwoYearAgo;
END$$
DELIMITER ;