Wednesday, January 15, 2014

Fetch Duplicate Artifacts in BPM 7.5

Get a list a artifacts duplicated across Process-App or Toolkits (Oracle 11g and up only)


WITH po AS ( 
    SELECT distinct
      ver.PO_NAME,
      ver.PO_TYPE,
    /*  snap.is_default,
      snap.name AS "Snapshot Name",
      snap.acronym AS "Snapshot Acronym",
      snap.is_archived AS "Is Snapshot Archived",
      proj.name AS "Process App",
    */ --LISTAGG(TO_CHAR(proj.short_name), '; ') within group( order by proj.short_name) AS "PROCESS APP ACRONYM",
    TO_CHAR(proj.short_name) AS short_name
    FROM bpi_procc_shr_shr.lsw_branch brnch,
      bpi_procc_shr_shr.lsw_po_versions ver,
      bpi_procc_shr_shr.lsw_snapshot snap,
      bpi_procc_shr_shr.lsw_project proj
    WHERE ver.branch_id       = brnch.branch_id
    AND brnch.tip_snapshot_id = snap.snapshot_id
    AND snap.project_id       = proj.project_id
    AND proj.short_name     NOT IN ('TWSYS', 'TWP', 'HSS', 'LSWPSC', 'SACOMMC', 'BDS2', 'SAPAPPS', 'OF_DEM')
    AND ver.PO_NAME IS NOT NULL
    AND snap.name IS NOT NULL
    AND
      -- ver.po_name like 'Submit Requisition' and
      snap.is_archived = 'F'-- and
      -- ver.end_seq_num is null
    ORDER BY ver.PO_NAME
    --group by ver.PO_NAME
)
select
  po.PO_NAME,
  po.PO_TYPE,
  LISTAGG(po.short_name, '; ') within group(order by po.short_name) AS "APP_LIST",
  count(1) "DUPLICATE COUNT"
--  po.short_name
from po
group by po.PO_NAME, po.PO_TYPE
having count(1) > 1
;

No comments:

Post a Comment