2020/07/16

Purge MRP_RELIEF_INTERFACE

--Reference Doc ID 2438153.1
--The profile values MRP: Consume MPS and MRP: Consume MDS value is 'N'.
DECLARE
  vMDSProfile  VARCHAR2(1);
  vMPSProfile  VARCHAR2(1);
  vForwardDays NUMBER := 90;
BEGIN
  vMDSProfile := fnd_profile.VALUE(NAME => 'MRP_MDS_CONSUMPTION');

  IF vMDSProfile = 'N' THEN
    DELETE mrp_relief_interface
    WHERE  process_status = 2
    AND    relief_type = 1
    AND    creation_date <= SYSDATE - vForwardDays;
    dbms_output.put_line('Delete Row Count [MDS] => ' || SQL%ROWCOUNT);
    COMMIT;
  END IF;

  vMPSProfile := fnd_profile.VALUE(NAME => 'MRP_MPS_CONSUMPTION');
  IF vMPSProfile = 'N' THEN
    DELETE mrp_relief_interface
    WHERE  process_status = 2
    AND    relief_type = 2
    AND    creation_date <= SYSDATE - vForwardDays;
    dbms_output.put_line('Delete Row Count => [MPS] ' || SQL%ROWCOUNT);
    COMMIT;
  END IF;
END;

沒有留言: