We have large number of errored workflow which are there from 2005. We want to purge those. Is there an standard procedure or script which can be used to purge the old unused errored, active workflow??
If the process is in error, then you need to abort the process - WF_ENGINE.AbortProcess is the API to call.
If the process has any child flows, then these must be complete before purging can take place - if they are running, then you need to abort them using the same API.
Once the process and all the child processes are complete, if they have been completed by the value of the persistence value for the Item Type, then you can purge them using the WF_PURGE APIs.
WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
Have you read the blog at http://www.workflowfaq.com/blog ?
WorkflowFAQ support forum: http://forum.workflowfaq.com
You can follow WorkflowFAQ.com advice but check if, as per your Apps release, the procedure has the parameters 'verify_lock' and 'cascade' (these were added as a sort of enhancement request). If you have them then pass FALSE and TRUE respectively. This will take care of canceling the underlying children processes. So basically you will:
create a cursor to identify those unwanted workflows
loop through the cursor and call WF_ENGINE.AbortProcess(iitemtype => <cursor.item type>, temkey => <cursor.item key>, verify_lock=> FALSE, cascade=>TRUE);
Those items will be removed by the purge when their persistence time has expired.
Remember to do this first on a TEST environment.