REM RMINC_SearchForPurgesAndDeletes.sql
REM Copyright 2006, All Rights Reserved, Reed-Matthews, Inc.

REM Searches for concurrent programs that Purge or Delete.  Some of these
REM are maintenance programs, intended for cleaning up certain database tables
ttitle 'Concurrent Programs That Purge or Delete'
SET linesize 180
COLUMN "APPLICATION" format a11
COLUMN "CONCURRENT PROGRAM NAME" format a50
COLUMN "SHORT NAME" format a35
set pagesize 999
select substr(b.application_short_name,1,11) "APPLICATION",
       substr(a.user_concurrent_program_name,1,50) "CONCURRENT PROGRAM NAME",
       substr(a.concurrent_program_name,1,35) "SHORT NAME"
from fnd_concurrent_programs_vl a,fnd_application_vl b
  where a.application_id=b.application_id
  and a.enabled_flag='Y'
  and (a.user_concurrent_program_name like '%urge%'
  or a.user_concurrent_program_name like '%elete%')
order by b.application_short_name;

REM Also checks to see if any purges or deletes have been run based on data in the
REM fnd_conc_req_summary_v view.  
ttitle 'Purge or Delete Programs Run Recently'
COLUMN "PROGRAM NAME" format a80
select request_id, substr(user_concurrent_program_name,1,80) "PROGRAM NAME", request_date from fnd_conc_req_summary_v
where user_concurrent_program_name like '%urge%' or user_concurrent_program_name like '%elete%'
order by request_date,"PROGRAM NAME";