27 lines
482 B
MySQL
27 lines
482 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`deliveryInformation_Delete`()
|
||
|
BEGIN
|
||
|
|
||
|
DECLARE vID INT;
|
||
|
DECLARE vGap INT DEFAULT 100;
|
||
|
DECLARE vTope INT;
|
||
|
|
||
|
SELECT MIN(ID), MAX(ID)
|
||
|
INTO vID, vTope
|
||
|
FROM edi.deliveryInformation;
|
||
|
|
||
|
WHILE vID <= vTope DO
|
||
|
|
||
|
SET vID = vID + vGap;
|
||
|
|
||
|
DELETE
|
||
|
FROM edi.deliveryInformation
|
||
|
WHERE ID < vID
|
||
|
AND EarliestDespatchDateTime IS NULL;
|
||
|
|
||
|
END WHILE;
|
||
|
|
||
|
|
||
|
END$$
|
||
|
DELIMITER ;
|