The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT WI.ITEM_TYPE, WI.ITEM_KEY
FROM (SELECT PERSISTENCE_DAYS, NAME
FROM WF_ITEM_TYPES
WHERE PERSISTENCE_TYPE = Wf_Purge.persistence_type and NAME=itemtype) WIT, WF_ITEMS WI
WHERE WI.ITEM_TYPE = WIT.NAME
AND WI.END_DATE <= enddate-nvl(WIT.PERSISTENCE_DAYS,0)
AND WI.END_DATE > xenddate
AND NOT EXISTS
(SELECT NULL
FROM WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.ITEM_TYPE = WI2.PARENT_ITEM_TYPE
AND PRIOR WI2.ITEM_KEY = WI2.PARENT_ITEM_KEY )
AND NOT EXISTS
(SELECT NULL
FROM WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.PARENT_ITEM_TYPE = WI2.ITEM_TYPE
AND PRIOR WI2.PARENT_ITEM_KEY = WI2.ITEM_KEY)
ORDER BY WI.END_DATE;
select WI.ITEM_TYPE, WI.ITEM_KEY
from WF_ITEMS WI
where WI.ITEM_TYPE = itemtype
and WI.ITEM_KEY = itemkey
and WI.end_date <= enddate
and exists
(select null
from WF_ITEM_TYPES WIT
where WI.END_DATE+nvl(WIT.PERSISTENCE_DAYS,0)<=enddate
and WI.ITEM_TYPE = WIT.NAME
and WIT.PERSISTENCE_TYPE = Wf_Purge.persistence_type)
and not exists
(select null
from WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.ITEM_TYPE = WI2.PARENT_ITEM_TYPE
AND PRIOR WI2.ITEM_KEY = WI2.PARENT_ITEM_KEY
UNION ALL
select null
from WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.PARENT_ITEM_TYPE = WI2.ITEM_TYPE
AND PRIOR WI2.PARENT_ITEM_KEY = WI2.ITEM_KEY);
select WI.ITEM_TYPE, WI.ITEM_KEY
from WF_ITEMS WI
where WI.ITEM_KEY = itemkey
and WI.ITEM_TYPE = itemtype
and WI.end_date <= enddate;
select /*+ first_rows index(WI,WF_ITEMS_N3) */
WI.ITEM_TYPE, WI.ITEM_KEY
from WF_ITEMS WI
where WI.END_DATE <= enddate
and WI.END_DATE > xenddate
and exists
(select null
from WF_ITEM_TYPES WIT
where WI.END_DATE+nvl(WIT.PERSISTENCE_DAYS,0)<=enddate
and WI.ITEM_TYPE = WIT.NAME
and WIT.PERSISTENCE_TYPE = Wf_Purge.persistence_type)
and not exists
(select null
from WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.ITEM_TYPE = WI2.PARENT_ITEM_TYPE
AND PRIOR WI2.ITEM_KEY = WI2.PARENT_ITEM_KEY
UNION ALL
select null
from WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.PARENT_ITEM_TYPE = WI2.ITEM_TYPE
AND PRIOR WI2.PARENT_ITEM_KEY = WI2.ITEM_KEY);
l_itemkeyTAB.DELETE(l_itemkeyTAB.LAST);
l_itemtypeTAB.DELETE(l_itemtypeTAB.LAST);
l_itemkeyTAB.DELETE(l_itemkeyTAB.LAST);
l_itemtypeTAB.DELETE(l_itemtypeTAB.LAST);
select WN.NOTIFICATION_ID
BULK COLLECT into l_tempListTAB
from WF_ITEM_ACTIVITY_STATUSES WIAS,
WF_NOTIFICATIONS WN
where WIAS.ITEM_TYPE = l_itemtypeTAB(j)
and WIAS.ITEM_KEY = l_itemkeyTAB(j)
and WIAS.NOTIFICATION_ID = WN.GROUP_ID
and ((purgesigs = 1)
or not exists
(select null
from WF_DIG_SIGS WDS
where SIG_OBJ_TYPE = 'WF_NTF'
and SIG_OBJ_ID = WN.NOTIFICATION_ID))
union all
select WN.NOTIFICATION_ID
from WF_ITEM_ACTIVITY_STATUSES_H WIASH,
WF_NOTIFICATIONS WN
where WIASH.ITEM_TYPE = l_itemtypeTAB(j)
and WIASH.ITEM_KEY = l_itemkeyTAB(j)
and WIASH.NOTIFICATION_ID = WN.GROUP_ID
and ((purgesigs = 1)
or not exists
(select null
from WF_DIG_SIGS WDS
where SIG_OBJ_TYPE = 'WF_NTF'
and SIG_OBJ_ID = WN.NOTIFICATION_ID));
delete from WF_NOTIFICATION_ATTRIBUTES WNA
where WNA.NOTIFICATION_ID = l_nidListTAB(i);
DELETE FROM wf_comments wc
WHERE wc.notification_id = l_nidListTAB(i);
delete from WF_NOTIFICATIONS WN
where WN.NOTIFICATION_ID = l_nidListTAB(i);
l_nidListTAB.DELETE(i);
delete from WF_ITEM_ACTIVITY_STATUSES_H
where ITEM_TYPE = l_itemtypeTAB(j)
and ITEM_KEY = l_itemkeyTAB(j);
delete from WF_ITEM_ACTIVITY_STATUSES
where ITEM_TYPE = l_itemtypeTAB(j)
and ITEM_KEY = l_itemkeyTAB(j);
delete from WF_ITEM_ATTRIBUTE_VALUES
where ITEM_TYPE = l_itemtypeTAB(j)
and ITEM_KEY = l_itemkeyTAB(j);
delete from WF_ITEMS
where ITEM_TYPE = l_itemtypeTAB(j)
and ITEM_KEY = l_itemkeyTAB(j);
select distinct WA.ITEM_TYPE, WA.NAME
from WF_ACTIVITIES WA
where WA.ITEM_TYPE = itemtype;
select distinct WA.ITEM_TYPE, WA.NAME
from WF_ACTIVITIES WA
where WA.ITEM_TYPE = itemtype
and WA.NAME = name;
select distinct WA.ITEM_TYPE, WA.NAME
from WF_ACTIVITIES WA;
select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME
from WF_PROCESS_ACTIVITIES WPA
where WPA.ACTIVITY_ITEM_TYPE = acttype
and WPA.ACTIVITY_NAME = actname
union
select WA.ITEM_TYPE PROCESS_ITEM_TYPE, WA.NAME PROCESS_NAME
from WF_ACTIVITIES WA
where WA.ERROR_ITEM_TYPE = acttype
and WA.ERROR_PROCESS IS NOT NULL;
select WPA.PROCESS_ITEM_TYPE, WPA.PROCESS_NAME
from WF_PROCESS_ACTIVITIES WPA
where WPA.ACTIVITY_ITEM_TYPE = acttype
and WPA.ACTIVITY_NAME = actname
union
select WA.ITEM_TYPE PROCESS_ITEM_TYPE, WA.NAME PROCESS_NAME
from WF_ACTIVITIES WA
where WA.ERROR_ITEM_TYPE = acttype
and WA.ERROR_PROCESS = actname;
select WA.BEGIN_DATE, WA.END_DATE, WA.VERSION
from WF_ACTIVITIES WA
where WA.ITEM_TYPE = acttype
and WA.NAME = actname
and exists
(select null
from WF_ITEM_TYPES WIT
where WA.END_DATE+nvl(WIT.PERSISTENCE_DAYS,0)<=enddate
and WA.ITEM_TYPE = WIT.NAME
and WIT.PERSISTENCE_TYPE = Wf_Purge.persistence_type);
select WI.ITEM_TYPE, WI.ITEM_KEY, WI.ROOT_ACTIVITY, WI.BEGIN_DATE
from WF_ITEMS WI
where WI.BEGIN_DATE between begdate and nvl(enddate, WI.BEGIN_DATE)
and WI.ITEM_TYPE = roottype;
select WI.ITEM_TYPE, WI.ITEM_KEY, WI.ROOT_ACTIVITY, WI.BEGIN_DATE
from WF_ITEMS WI
where WI.BEGIN_DATE between begdate and nvl(enddate, WI.BEGIN_DATE)
and WI.ITEM_TYPE = roottype
and WI.ROOT_ACTIVITY = rootname ;
delete from WF_ACTIVITY_ATTR_VALUES WAAV
where WAAV.PROCESS_ACTIVITY_ID in
(select WPA.INSTANCE_ID
from WF_PROCESS_ACTIVITIES WPA
where WPA.PROCESS_NAME = c_name
and WPA.PROCESS_ITEM_TYPE = c_item_type
and WPA.PROCESS_VERSION = ver.version);
delete from WF_ACTIVITY_TRANSITIONS WAT
where WAT.TO_PROCESS_ACTIVITY in
(select WPA.INSTANCE_ID
from WF_PROCESS_ACTIVITIES WPA
where WPA.PROCESS_NAME = c_name
and WPA.PROCESS_ITEM_TYPE = c_item_type
and WPA.PROCESS_VERSION = ver.version);
delete from WF_ACTIVITY_TRANSITIONS WAT
where WAT.FROM_PROCESS_ACTIVITY in
(select WPA.INSTANCE_ID
from WF_PROCESS_ACTIVITIES WPA
where WPA.PROCESS_NAME = c_name
and WPA.PROCESS_ITEM_TYPE = c_item_type
and WPA.PROCESS_VERSION = ver.version);
delete from WF_PROCESS_ACTIVITIES WPA
where WPA.PROCESS_NAME = c_name
and WPA.PROCESS_ITEM_TYPE = c_item_type
and WPA.PROCESS_VERSION = ver.version;
delete from WF_ACTIVITY_ATTRIBUTES_TL WAAT
where WAAT.ACTIVITY_NAME = c_name
and WAAT.ACTIVITY_ITEM_TYPE = c_item_type
and WAAT.ACTIVITY_VERSION = ver.version;
delete from WF_ACTIVITY_ATTRIBUTES WAA
where WAA.ACTIVITY_NAME = c_name
and WAA.ACTIVITY_ITEM_TYPE = c_item_type
and WAA.ACTIVITY_VERSION = ver.version;
delete from WF_ACTIVITIES_TL WAT
where WAT.NAME = c_name
and WAT.ITEM_TYPE = c_item_type
and WAT.VERSION = ver.version;
delete from WF_ACTIVITIES WA
where WA.NAME = c_name
and WA.ITEM_TYPE = c_item_type
and WA.VERSION = ver.version;
select count(1)
into numvers
from WF_ACTIVITIES WA
where WA.NAME = c_name
and WA.ITEM_TYPE = c_item_type;
delete from WF_PROCESS_ACTIVITIES WPA
where WPA.PROCESS_ITEM_TYPE = c_item_type
and WPA.PROCESS_NAME = 'ROOT'
and WPA.ACTIVITY_ITEM_TYPE = c_item_type
and WPA.ACTIVITY_NAME = c_name;
delete
from WF_ENTITY_CHANGES
where CHANGE_DATE <= p_enddate;
select WN.NOTIFICATION_ID
from WF_NOTIFICATIONS WN
where WN.MESSAGE_TYPE = itemtype
and not exists
(select NULL
from WF_ITEM_ACTIVITY_STATUSES WIAS
where WIAS.NOTIFICATION_ID = WN.GROUP_ID)
and not exists
(select NULL
from WF_ITEM_ACTIVITY_STATUSES_H WIAS
where WIAS.NOTIFICATION_ID = WN.GROUP_ID)
and (
exists(
select null
from WF_ITEM_TYPES WIT
where WN.END_DATE+nvl(WIT.PERSISTENCE_DAYS,0) <= enddate
and WN.MESSAGE_TYPE = WIT.NAME
and WIT.PERSISTENCE_TYPE = Wf_Purge.persistence_type)
or not exists(
select null
from WF_ITEM_TYPES WIT
where WN.MESSAGE_TYPE = WIT.NAME))
and(
(purgesigs = 1)
or not exists
(select null
from WF_DIG_SIGS WDS
where SIG_OBJ_TYPE = 'WF_NTF'
and SIG_OBJ_ID = WN.NOTIFICATION_ID));
select WN.NOTIFICATION_ID
from WF_NOTIFICATIONS WN
where not exists
(select NULL
from WF_ITEM_ACTIVITY_STATUSES WIAS
where WIAS.NOTIFICATION_ID = WN.GROUP_ID)
and not exists
(select NULL
from WF_ITEM_ACTIVITY_STATUSES_H WIAS
where WIAS.NOTIFICATION_ID = WN.GROUP_ID)
and (
exists(
select null
from WF_ITEM_TYPES WIT
where WN.END_DATE+nvl(WIT.PERSISTENCE_DAYS,0) <= enddate
and WN.MESSAGE_TYPE = WIT.NAME
and WIT.PERSISTENCE_TYPE = Wf_Purge.persistence_type)
or not exists(
select null
from WF_ITEM_TYPES WIT
where WN.MESSAGE_TYPE = WIT.NAME))
and(
(purgesigs = 1)
or not exists
(select null
from WF_DIG_SIGS WDS
where SIG_OBJ_TYPE = 'WF_NTF'
and SIG_OBJ_ID = WN.NOTIFICATION_ID));
UPDATE wf_notifications wn
SET end_date = nvl(begin_date, to_date('2002/08/01','YYYY/MM/DD')) + 1
WHERE NOT EXISTS
(SELECT NULL
FROM wf_item_activity_statuses wias
WHERE wias.notification_id = wn.group_id)
AND NOT EXISTS
(SELECT NULL
FROM wf_item_activity_statuses_h wiash
WHERE wiash.notification_id = wn.group_id)
AND wn.end_date is null
AND wn.begin_date <= enddate
AND rownum < Wf_Purge.Commit_Frequency;
delete from WF_NOTIFICATION_ATTRIBUTES WNA
where WNA.NOTIFICATION_ID = l_nidListTAB(j);
DELETE FROM wf_comments wc
WHERE wc.notification_id = l_nidListTAB(j);
delete from WF_NOTIFICATIONS WN
where WN.NOTIFICATION_ID = l_nidListTAB(j);
select local.NAME, local.ORIG_SYSTEM, local.ORIG_SYSTEM_ID
from WF_LOCAL_ROLES PARTITION(WF_LOCAL_ROLES) local
where ORIG_SYSTEM = 'WF_LOCAL_USERS'
and EXPIRATION_DATE <= end_date
and local.USER_FLAG='Y'
and not exists
(select NULL
from WF_NOTIFICATIONS wn
where wn.RECIPIENT_ROLE = local.NAME
or wn.ORIGINAL_RECIPIENT = local.NAME);
select local.NAME, local.ORIG_SYSTEM, local.ORIG_SYSTEM_ID
from WF_LOCAL_ROLES PARTITION(WF_LOCAL_ROLES) local
where ORIG_SYSTEM = 'WF_LOCAL_ROLES'
and EXPIRATION_DATE <= end_date
and local.USER_FLAG='N'
and not exists
(select NULL
from WF_ROLE_HIERARCHIES
where SUPER_NAME = local.NAME
or SUB_NAME = local.NAME)
and not exists
(select NULL
from WF_NOTIFICATIONS wn
where wn.RECIPIENT_ROLE = local.NAME
or wn.ORIGINAL_RECIPIENT = local.NAME);
select local.NAME, local.ORIG_SYSTEM, local.ORIG_SYSTEM_ID
from WF_LOCAL_ROLES local
where ORIG_SYSTEM = p_origSystem
and (p_endDate is NULL or EXPIRATION_DATE <= p_endDate)
and local.USER_FLAG='N'
and not exists
(select NULL
from WF_ROLE_HIERARCHIES
where SUPER_NAME = local.NAME
or SUB_NAME = local.NAME)
and not exists
(select NULL
from WF_NOTIFICATIONS wn
where wn.RECIPIENT_ROLE = local.NAME
or wn.ORIGINAL_RECIPIENT = local.NAME);
select local.NAME, local.ORIG_SYSTEM, local.ORIG_SYSTEM_ID
from WF_LOCAL_ROLES local
where ORIG_SYSTEM = p_origSystem
and (p_endDate is NULL or EXPIRATION_DATE <= p_endDate)
and local.USER_FLAG='Y'
and not exists
(select NULL
from WF_USER_ROLE_ASSIGNMENTS
where USER_NAME = local.NAME
and RELATIONSHIP_ID <> -1)
and not exists
(select NULL
from WF_NOTIFICATIONS wn
where wn.RECIPIENT_ROLE = local.NAME
or wn.ORIGINAL_RECIPIENT = local.NAME)
and not exists
(select NULL
from WF_ITEMS wi
where wi.OWNER_ROLE = local.NAME);
select wlur.user_name, wlur.user_orig_system, wlur.user_orig_system_id,
wlur.role_name, wlur.role_orig_system, wlur.role_orig_system_id
from WF_LOCAL_USER_ROLES PARTITION (WF_LOCAL_ROLES) WLUR
where (WLUR.ROLE_ORIG_SYSTEM='WF_LOCAL_ROLES' or WLUR.USER_ORIG_SYSTEM='WF_LOCAL_USERS')
and WLUR.EFFECTIVE_END_DATE <= directory.end_date;
select wlur.user_name, wlur.user_orig_system, wlur.user_orig_system_id,
wlur.role_name, wlur.role_orig_system, wlur.role_orig_system_id
from WF_LOCAL_USER_ROLES WLUR, WF_LOCAL_ROLES WLR
where WLR.ORIG_SYSTEM=p_origSystem
and ((WLR.NAME=WLUR.USER_NAME and WLR.ORIG_SYSTEM=WLUR.USER_ORIG_SYSTEM)
or
(WLR.NAME=WLUR.ROLE_NAME and WLR.ORIG_SYSTEM=WLUR.ROLE_ORIG_SYSTEM))
and WLUR.PARTITION_ID = 0
and WLUR.EFFECTIVE_END_DATE <= p_endDate;
delete from WF_LOCAL_USER_ROLES local
where local.ROLE_NAME = roleTab(idx).name
and local.ROLE_ORIG_SYSTEM = roleTab(idx).orig_system
and local.ROLE_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_USER_ROLE_ASSIGNMENTS local
where local.ROLE_NAME = roleTab(idx).name
and local.ROLE_ORIG_SYSTEM = roleTab(idx).orig_system
and local.ROLE_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_ROLES local
where local.NAME = roleTab(idx).name
and local.ORIG_SYSTEM = roleTab(idx).orig_system
and local.ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_USER_ROLES local
where local.USER_NAME = roleTab(idx).name
and local.USER_ORIG_SYSTEM = roleTab(idx).orig_system
and local.USER_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_USER_ROLE_ASSIGNMENTS local
where local.USER_NAME = roleTab(idx).name
and local.USER_ORIG_SYSTEM = roleTab(idx).orig_system
and local.USER_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_ROLES local
where local.NAME = roleTab(idx).name
and local.ORIG_SYSTEM = roleTab(idx).orig_system
and local.ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_USER_ROLES local
where local.USER_NAME = expRoleTab(idx).USER_NAME
and local.USER_ORIG_SYSTEM = expRoleTab(idx).USER_ORIG_SYSTEM
and local.USER_ORIG_SYSTEM_ID = expRoleTab(idx).USER_ORIG_SYSTEM_ID
and local.ROLE_NAME = expRoleTab(idx).ROLE_NAME
and local.ROLE_ORIG_SYSTEM = expRoleTab(idx).ROLE_ORIG_SYSTEM
and local.ROLE_ORIG_SYSTEM_ID = expRoleTab(idx).ROLE_ORIG_SYSTEM_ID;
delete from WF_USER_ROLE_ASSIGNMENTS local
where local.USER_NAME = expRoleTab(idx).USER_NAME
and local.USER_ORIG_SYSTEM = expRoleTab(idx).USER_ORIG_SYSTEM
and local.USER_ORIG_SYSTEM_ID = expRoleTab(idx).USER_ORIG_SYSTEM_ID
and local.ROLE_NAME = expRoleTab(idx).ROLE_NAME
and local.ROLE_ORIG_SYSTEM = expRoleTab(idx).ROLE_ORIG_SYSTEM
and local.ROLE_ORIG_SYSTEM_ID = expRoleTab(idx).ROLE_ORIG_SYSTEM_ID;
delete from WF_LOCAL_USER_ROLES local
where local.ROLE_NAME = roleTab(idx).name
and local.ROLE_ORIG_SYSTEM = roleTab(idx).orig_system
and local.ROLE_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_USER_ROLE_ASSIGNMENTS local
where local.ROLE_NAME = roleTab(idx).name
and local.ROLE_ORIG_SYSTEM = roleTab(idx).orig_system
and local.ROLE_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_ROLES PARTITION(WF_LOCAL_ROLES) local
where local.NAME = roleTab(idx).name
and local.ORIG_SYSTEM = roleTab(idx).orig_system
and local.ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_USER_ROLES local
where local.USER_NAME = roleTab(idx).name
and local.USER_ORIG_SYSTEM = roleTab(idx).orig_system
and local.USER_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_USER_ROLE_ASSIGNMENTS local
where local.USER_NAME = roleTab(idx).name
and local.USER_ORIG_SYSTEM = roleTab(idx).orig_system
and local.USER_ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_ROLES PARTITION(WF_LOCAL_ROLES) local
where local.NAME = roleTab(idx).name
and local.ORIG_SYSTEM = roleTab(idx).orig_system
and local.ORIG_SYSTEM_ID = roleTab(idx).orig_system_id;
delete from WF_LOCAL_USER_ROLES local
where local.USER_NAME = expRoleTab(idx).USER_NAME
and local.USER_ORIG_SYSTEM = expRoleTab(idx).USER_ORIG_SYSTEM
and local.USER_ORIG_SYSTEM_ID = expRoleTab(idx).USER_ORIG_SYSTEM_ID
and local.ROLE_NAME = expRoleTab(idx).ROLE_NAME
and local.ROLE_ORIG_SYSTEM = expRoleTab(idx).ROLE_ORIG_SYSTEM
and local.ROLE_ORIG_SYSTEM_ID = expRoleTab(idx).ROLE_ORIG_SYSTEM_ID;
delete from WF_USER_ROLE_ASSIGNMENTS local
where local.USER_NAME = expRoleTab(idx).USER_NAME
and local.USER_ORIG_SYSTEM = expRoleTab(idx).USER_ORIG_SYSTEM
and local.USER_ORIG_SYSTEM_ID = expRoleTab(idx).USER_ORIG_SYSTEM_ID
and local.ROLE_NAME = expRoleTab(idx).ROLE_NAME
and local.ROLE_ORIG_SYSTEM = expRoleTab(idx).ROLE_ORIG_SYSTEM
and local.ROLE_ORIG_SYSTEM_ID = expRoleTab(idx).ROLE_ORIG_SYSTEM_ID;
select Count(*) into l_purgeable
from WF_ITEMS WI
where WI.ITEM_TYPE = p_itemType
and WI.END_DATE <= sysdate
and exists
(select null
from WF_ITEM_TYPES WIT
where WI.END_DATE+nvl(WIT.PERSISTENCE_DAYS,0)<=sysdate
and WI.ITEM_TYPE = WIT.NAME
)
and not exists
(select null
from WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.ITEM_TYPE = WI2.PARENT_ITEM_TYPE
AND PRIOR WI2.ITEM_KEY = WI2.PARENT_ITEM_KEY
UNION ALL
select null
from WF_ITEMS WI2
WHERE WI2.END_DATE IS NULL
START WITH WI2.ITEM_TYPE = WI.ITEM_TYPE
AND WI2.ITEM_KEY = WI.ITEM_KEY
CONNECT BY PRIOR WI2.PARENT_ITEM_TYPE = WI2.ITEM_TYPE
AND PRIOR WI2.PARENT_ITEM_KEY = WI2.ITEM_KEY);
select wi.item_key
from wf_item_activity_statuses wias, wf_items wi
where wi.item_type = 'WFERROR'
and parent_item_type = itemtype
and wi.parent_item_type = wias.item_type
and wi.parent_item_key = wias.item_key
and wi.parent_context = wias.process_activity
and wi.end_date is null
and wias.activity_status = 'COMPLETE';
select wi.item_key
from wf_item_activity_statuses wias, wf_items wi
where wi.item_type = 'WFERROR'
and parent_item_type = itemtype
and parent_item_key = itemkey
and wi.parent_item_type = wias.item_type
and wi.parent_item_key = wias.item_key
and wi.parent_context = wias.process_activity
and wi.end_date is null
and wias.activity_status = 'COMPLETE';
select wi.item_key
from wf_item_activity_statuses wias, wf_items wi
where wi.item_type = 'WFERROR'
and wi.parent_item_type = wias.item_type
and wi.parent_item_key = wias.item_key
and wi.parent_context = wias.process_activity
and wi.end_date is null
and wias.activity_status = 'COMPLETE';