WHERE infa_record_customer_id in (SELECT infa_record_customer_id
FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S120-SUPPLIER' ) and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S35-SUPPLIER') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S72-SUPPLIER') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S70-SUPPLIER') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S50-SUPPLIER') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S120') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S35') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S72') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S70') and rownum =1; delete FROM ebs_hdno_tgt_cust_location WHERE infa_record_customer_id in (SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account WHERE orig_system_reference ='S50') and rownum =1;
DELETE FROM ebs_hdno_tgt_cust_party_site
WHERE infa_record_location_id NOT IN (SELECT INFA_RECORD_LOCATION_ID FROM ebs_hd no_tgt_cust_location); DELETE FROM ebs_hdno_tgt_cust_acct_site WHERE infa_record_party_site_id NOT IN (SELECT infa_record_party_site_id FROM eb s_hdno_tgt_cust_party_site); DELETE FROM ebs_hdno_tgt_cust_site_use WHERE infa_record_cust_acct_site_id NOT IN (SELECT infa_record_cust_acct_site_id FROM ebs_hdno_tgt_cust_acct_site); DELETE FROM ebs_hdno_tgt_cust_payer_instr WHERE infa_record_site_use_id NOT IN (SELECT infa_record_site_use_id FROM ebs_hd no_tgt_cust_site_use); --remove duplicate contact details DELETE FROM ebs_hdno_tgt_cust_contacts A WHERE ROWID > ( SELECT min(rowid) FROM ebs_hdno_tgt_cust_contacts B WHERE A.infa_record_customer_id = B.infa_record_customer_id); --Removing duplicate bank acct records with bank acct num is null delete from ebs_hdno_tgt_cust_bank_accts where infa_record_customer_id in( SELECT infa_record_customer_id FROM ebs_hdno_tgt_cust_account where orig_system_reference in( 'S120-SUPPLIER', 'S35-SUPPLIER', 'S72-SUPPLIER', 'S70-SUPPLIER', 'S50-SUPPLIER')) and bank_account_num is null;