Purging and Cleaning SOA instance

CREATE OR REPLACE PROCEDURE “SOA_BPMS_PURGE”

IS
MIN_CREATION_DATE TIMESTAMP;
MAX_CREATION_DATE TIMESTAMP;
BATCH_SIZE NUMBER;
MAX_RUNTIME NUMBER;
RETENTION_PERIOD TIMESTAMP;
PURGE_PARTITIONED_COMPONENT BOOLEAN;

cursor comList is
select COMPOSITE_NAME,COMPOSITE_REVISION,SOA_PARTITION_NAME
from SOA_PURGE_LIST where status=1;

COMPOSITE_NAME VARCHAR2(200);
COMPOSITE_REVISION VARCHAR2(200);
SOA_PARTITION_NAME VARCHAR2(200);

BEGIN

DBMS_OUTPUT.ENABLE;

MIN_CREATION_DATE := to_timestamp(‘2010-10-04′,’YYYY-MM-DD’);
MAX_CREATION_DATE := to_timestamp(sysdate,’YYYY-MM-DD’);
BATCH_SIZE := 1000;
MAX_RUNTIME := 60;
RETENTION_PERIOD := to_timestamp(sysdate,’YYYY-MM-DD’);
PURGE_PARTITIONED_COMPONENT := false;

FOR composite in comList
LOOP

COMPOSITE_NAME := composite.COMPOSITE_NAME;
COMPOSITE_REVISION := composite.COMPOSITE_REVISION;
SOA_PARTITION_NAME :=composite.SOA_PARTITION_NAME;

dbms_output.put_line (‘Start Processing ‘||COMPOSITE_NAME||’ Start Time is: [‘||to_timestamp(sysdate)||’]’);

soainfra.SOA.delete_instances (  MIN_CREATION_DATE => MIN_CREATION_DATE,
MAX_CREATION_DATE => MAX_CREATION_DATE,
BATCH_SIZE => BATCH_SIZE,
MAX_RUNTIME => MAX_RUNTIME,
RETENTION_PERIOD => RETENTION_PERIOD,
PURGE_PARTITIONED_COMPONENT => PURGE_PARTITIONED_COMPONENT,
COMPOSITE_NAME => COMPOSITE_NAME,
COMPOSITE_REVISION => COMPOSITE_REVISION,
SOA_PARTITION_NAME => SOA_PARTITION_NAME
);

dbms_output.put_line (‘Done with Processing ‘||COMPOSITE_NAME||’ End Time is: [‘||to_timestamp(sysdate)||’]’);

END loop;

END;

/