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

15 lines
337 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `dipole`.`clean`()
BEGIN
DECLARE vFromDated DATE;
SET vFromDated = TIMESTAMPADD(WEEK, -2, util.VN_CURDATE());
DELETE FROM dipole.expedition_PrintOut
WHERE created < vFromDated;
DELETE FROM dipole.expedition_Read
WHERE created < vFromDated;
END$$
DELIMITER ;