475: or exists (select 'Y' from HZ_PARTY_SITES
476: xx where xx.PARTY_ID = temp.party_id
477: and (nvl(STATUS, 'A') in ('A','I'))
478: and exists
479: (select 'Y' from IEX_CASE_CONTACTS
480: yy where yy.ADDRESS_ID=xx.PARTY_SITE_ID
481: ));
482: else
483: delete from hz_purge_gt temp where
489: or exists (select 'Y' from HZ_PARTY_SITES
490: xx where xx.PARTY_ID = temp.party_id
491: and (nvl(STATUS, 'A') in ('A','I'))
492: and exists
493: (select 'Y' from IEX_CASE_CONTACTS
494: yy where yy.ADDRESS_ID=xx.PARTY_SITE_ID
495: ));
496: end if;
497: