1250: (select 'Y' from AS_ACCESSES_ALL
1251: yy where yy.PARTNER_ADDRESS_ID=xx.PARTY_SITE_ID
1252: ))
1253:
1254: or exists (select 'Y' from AS_SALES_LEADS xx where xx.CUSTOMER_ID = temp.party_id
1255: )
1256:
1257: or exists (select 'Y' from AS_SALES_LEAD_CONTACTS xx where xx.CUSTOMER_ID = temp.party_id
1258: )
1432: or exists (select 'Y' from HZ_PARTY_SITES
1433: xx where xx.PARTY_ID = temp.party_id
1434: and (nvl(STATUS, 'A') in ('A','I'))
1435: and exists
1436: (select 'Y' from AS_SALES_LEADS
1437: yy where yy.ADDRESS_ID=xx.PARTY_SITE_ID
1438: ))
1439:
1440: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CONTACT_PARTY_ID = temp.party_id
1436: (select 'Y' from AS_SALES_LEADS
1437: yy where yy.ADDRESS_ID=xx.PARTY_SITE_ID
1438: ))
1439:
1440: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CONTACT_PARTY_ID = temp.party_id
1441: )
1442:
1443: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CNT_PERSON_PARTY_ID = temp.party_id
1444: )
1439:
1440: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CONTACT_PARTY_ID = temp.party_id
1441: )
1442:
1443: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CNT_PERSON_PARTY_ID = temp.party_id
1444: )
1445:
1446: or exists (select 'Y' from HZ_CONTACT_POINTS
1447: xx where xx.OWNER_TABLE_ID = temp.party_id
1446: or exists (select 'Y' from HZ_CONTACT_POINTS
1447: xx where xx.OWNER_TABLE_ID = temp.party_id
1448: and (OWNER_TABLE_NAME='HZ_PARTIES' AND nvl(STATUS, 'A') in ('A','I'))
1449: and exists
1450: (select 'Y' from AS_SALES_LEADS
1451: yy where yy.PRIMARY_CONTACT_PHONE_ID=xx.CONTACT_POINT_ID
1452: ))
1453: or exists (select 'Y' from HZ_PARTY_SITES
1454: xx where xx.PARTY_ID = temp.party_id
1457: (select 'Y' from HZ_CONTACT_POINTS
1458: yy where yy.OWNER_TABLE_ID=xx.PARTY_SITE_ID
1459: and OWNER_TABLE_NAME='HZ_PARTY_SITES' AND nvl(STATUS, 'A') in ('A','I')
1460: and exists
1461: (select 'Y' from AS_SALES_LEADS zz where zz.PRIMARY_CONTACT_PHONE_ID = yy.CONTACT_POINT_ID )))
1462:
1463: or exists (select 'Y' from AS_AP_ACCOUNT_PLANS xx where xx.CUST_PARTY_ID = temp.party_id
1464: );
1465: else
1569: (select 'Y' from AS_ACCESSES_ALL
1570: yy where yy.PARTNER_ADDRESS_ID=xx.PARTY_SITE_ID
1571: ))
1572:
1573: or exists (select 'Y' from AS_SALES_LEADS xx where xx.CUSTOMER_ID = temp.party_id
1574: )
1575:
1576: or exists (select 'Y' from AS_SALES_LEAD_CONTACTS xx where xx.CUSTOMER_ID = temp.party_id
1577: )
1751: or exists (select 'Y' from HZ_PARTY_SITES
1752: xx where xx.PARTY_ID = temp.party_id
1753: and (nvl(STATUS, 'A') in ('A','I'))
1754: and exists
1755: (select 'Y' from AS_SALES_LEADS
1756: yy where yy.ADDRESS_ID=xx.PARTY_SITE_ID
1757: ))
1758:
1759: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CONTACT_PARTY_ID = temp.party_id
1755: (select 'Y' from AS_SALES_LEADS
1756: yy where yy.ADDRESS_ID=xx.PARTY_SITE_ID
1757: ))
1758:
1759: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CONTACT_PARTY_ID = temp.party_id
1760: )
1761:
1762: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CNT_PERSON_PARTY_ID = temp.party_id
1763: )
1758:
1759: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CONTACT_PARTY_ID = temp.party_id
1760: )
1761:
1762: or exists (select 'Y' from AS_SALES_LEADS xx where xx.PRIMARY_CNT_PERSON_PARTY_ID = temp.party_id
1763: )
1764:
1765: or exists (select 'Y' from HZ_CONTACT_POINTS
1766: xx where xx.OWNER_TABLE_ID = temp.party_id
1765: or exists (select 'Y' from HZ_CONTACT_POINTS
1766: xx where xx.OWNER_TABLE_ID = temp.party_id
1767: and (OWNER_TABLE_NAME='HZ_PARTIES' AND nvl(STATUS, 'A') in ('A','I'))
1768: and exists
1769: (select 'Y' from AS_SALES_LEADS
1770: yy where yy.PRIMARY_CONTACT_PHONE_ID=xx.CONTACT_POINT_ID
1771: ))
1772: or exists (select 'Y' from HZ_PARTY_SITES
1773: xx where xx.PARTY_ID = temp.party_id
1776: (select 'Y' from HZ_CONTACT_POINTS
1777: yy where yy.OWNER_TABLE_ID=xx.PARTY_SITE_ID
1778: and OWNER_TABLE_NAME='HZ_PARTY_SITES' AND nvl(STATUS, 'A') in ('A','I')
1779: and exists
1780: (select 'Y' from AS_SALES_LEADS zz where zz.PRIMARY_CONTACT_PHONE_ID = yy.CONTACT_POINT_ID )))
1781:
1782: or exists (select 'Y' from AS_AP_ACCOUNT_PLANS xx where xx.CUST_PARTY_ID = temp.party_id
1783: );
1784: end if;
3974: delete /*+ parallel(temp) */ from hz_purge_gt temp where
3975: temp.party_id in (select /*+ parallel(xx)*/ xx.OPERATOR_PARTY_ID from AHL_ROUTES_B xx
3976: );
3977: end if;
3978: --AS_SALES_LEADS;INCUMBENT_PARTNER_PARTY_ID
3979: appid:=279;
3980: if(regid_proc = true) then
3981: insert into hz_application_trans_gt(app_id,party_id) select 279, temp.party_id from hz_purge_gt temp where not exists(select 'Y' from hz_application_trans_gt appl where appl.app_id = 279 and appl.party_id=temp.party_id) and
3982:
3979: appid:=279;
3980: if(regid_proc = true) then
3981: insert into hz_application_trans_gt(app_id,party_id) select 279, temp.party_id from hz_purge_gt temp where not exists(select 'Y' from hz_application_trans_gt appl where appl.app_id = 279 and appl.party_id=temp.party_id) and
3982:
3983: temp.party_id in (select /*+ parallel(xx)*/ xx.INCUMBENT_PARTNER_PARTY_ID from AS_SALES_LEADS xx
3984: );
3985: else
3986: delete /*+ parallel(temp) */ from hz_purge_gt temp where
3987: temp.party_id in (select /*+ parallel(xx)*/ xx.INCUMBENT_PARTNER_PARTY_ID from AS_SALES_LEADS xx
3983: temp.party_id in (select /*+ parallel(xx)*/ xx.INCUMBENT_PARTNER_PARTY_ID from AS_SALES_LEADS xx
3984: );
3985: else
3986: delete /*+ parallel(temp) */ from hz_purge_gt temp where
3987: temp.party_id in (select /*+ parallel(xx)*/ xx.INCUMBENT_PARTNER_PARTY_ID from AS_SALES_LEADS xx
3988: );
3989: end if;
3990: --AS_SALES_CREDITS_DENORM;CLOSE_COMPETITOR_ID
3991: appid:=279;
4056: delete /*+ parallel(temp) */ from hz_purge_gt temp where
4057: temp.party_id in (select /*+ parallel(xx)*/ xx.CUSTOMER_ID from AS_CURRENT_ENVIRONMENT xx
4058: );
4059: end if;
4060: --AS_SALES_LEADS;REFERRED_BY
4061: appid:=279;
4062: if(regid_proc = true) then
4063: insert into hz_application_trans_gt(app_id,party_id) select 279, temp.party_id from hz_purge_gt temp where not exists(select 'Y' from hz_application_trans_gt appl where appl.app_id = 279 and appl.party_id=temp.party_id) and
4064:
4061: appid:=279;
4062: if(regid_proc = true) then
4063: insert into hz_application_trans_gt(app_id,party_id) select 279, temp.party_id from hz_purge_gt temp where not exists(select 'Y' from hz_application_trans_gt appl where appl.app_id = 279 and appl.party_id=temp.party_id) and
4064:
4065: temp.party_id in (select /*+ parallel(xx)*/ xx.REFERRED_BY from AS_SALES_LEADS xx
4066: );
4067: else
4068: delete /*+ parallel(temp) */ from hz_purge_gt temp where
4069: temp.party_id in (select /*+ parallel(xx)*/ xx.REFERRED_BY from AS_SALES_LEADS xx
4065: temp.party_id in (select /*+ parallel(xx)*/ xx.REFERRED_BY from AS_SALES_LEADS xx
4066: );
4067: else
4068: delete /*+ parallel(temp) */ from hz_purge_gt temp where
4069: temp.party_id in (select /*+ parallel(xx)*/ xx.REFERRED_BY from AS_SALES_LEADS xx
4070: );
4071: end if;
4072: --AMW_ASSESSMENTS_B;ASSESSMENT_OWNER_ID
4073: appid:=242;