Find banks that have no active internal, external bank accounts and bank branch
select a.bank_party_id, a.bank_name, a.bank_number, a.home_country,
a.start_date, to_char(a.end_date, 'DD-MM-YYYY')
from ce_banks_v a
where not exists
(select iba.bank_id from ce_bank_accounts iba
where a.bank_party_id = iba.bank_id
and nvl(iba.end_date, sysdate) >= sysdate)
and not exists
(select eba.bank_id from iby_ext_bank_accounts eba
where a.bank_party_id = eba.bank_id
and nvl(eba.end_date, sysdate) >= sysdate)
and not exists
(select bb.bank_party_id from ce_bank_branches_v bb
where a.bank_party_id = bb.bank_party_id )