Query-
SELECT role_acct.account_number, hzp.party_name, hl.address1, hl.address2,
hl.city, hl.state, hl.postal_code, cont_party.person_last_name,
cont_party.person_first_name,
DECODE (hcp.phone_line_type,
'GEN', hcp.phone_area_code || hcp.phone_number,
NULL
) phone_number,
hcp.phone_extension,
DECODE (hcp.phone_line_type,
'FAX', hcp.phone_area_code || hcp.phone_number,
NULL
) fax_number,
cont.orig_system_reference
FROM hz_cust_account_roles cont,
hz_parties cont_party,
hz_relationships cont_rel,
hz_org_contacts cont_org,
hz_parties cont_rel_party,
ar_lookups l,
ar_lookups l1,
hz_contact_restrictions cont_res,
hz_person_language per_lang,
hz_contact_points cont_point,
hz_cust_account_roles acct_role,
hz_parties party,
hz_parties rel_party,
hz_relationships rel,
hz_org_contacts org_cont,
hz_cust_accounts role_acct,
hz_cust_accounts cont_role_acct,
hz_contact_points hcp,
hz_parties hzp,
hz_party_sites hps,
hz_cust_acct_sites_all hcas,
hz_locations hl
WHERE cont_org.title = l.lookup_code(+)
AND l.lookup_type(+) = 'CONTACT_TITLE'
AND cont_org.job_title_code = l1.lookup_code(+)
AND l1.lookup_type(+) = 'RESPONSIBILITY'
AND cont.cust_account_role_id = acct_role.cust_account_role_id
AND cont.party_id = cont_rel.party_id
AND cont.role_type = 'CONTACT'
AND cont_org.party_relationship_id = cont_rel.relationship_id
AND cont_rel.subject_id = cont_party.party_id
AND cont_rel.party_id = cont_rel_party.party_id
AND acct_role.party_id = rel.party_id
AND acct_role.role_type = 'CONTACT'
AND org_cont.party_relationship_id = rel.relationship_id
AND rel.subject_id = party.party_id
AND rel_party.party_id = rel.party_id
AND party.party_id = per_lang.party_id(+)
AND per_lang.native_language(+) = 'Y'
AND cont_point.owner_table_id(+) = rel_party.party_id
AND cont_point.contact_point_type(+) = 'EMAIL'
AND cont_point.primary_flag(+) = 'Y'
AND party.party_id = cont_res.subject_id(+)
AND cont_res.subject_table(+) = 'HZ_PARTIES'
AND cont.cust_account_id = cont_role_acct.cust_account_id
AND cont_role_acct.party_id = cont_rel.object_id
AND acct_role.cust_account_id = role_acct.cust_account_id
AND role_acct.party_id = rel.object_id
AND rel_party.party_id = hcp.owner_table_id(+)
AND hzp.party_id = role_acct.party_id
AND role_acct.party_id = hps.party_id
AND hps.party_site_id = hcas.party_site_id
AND hl.location_id = hps.location_id
AND cont_org.party_site_id = hcas.party_site_id
AND role_acct.account_number='10508'
AND cont_point.email_address like 'DOCLINKCUSTOMERCARE@QLOGIC.COM'
ORDER BY role_acct.account_number, cont.cust_account_role_id;