SELECT DISTINCT hpu.Name,o.organization_id,p.party_name,
ca.account_number,loc.address1, loc.address2, loc.address3,
loc.city,loc.postal_code, loc.country, ca.cust_account_id
FROM apps.ra_customer_trx_all i,
apps.hz_cust_accounts ca,
apps.hz_parties p,
apps.hr_operating_units hpu,
apps.hz_locations loc,
apps.hz_cust_site_uses_all csu,
apps.hz_cust_acct_sites_all cas,
apps.hz_party_sites ps,
apps.hr_all_organization_units o,
apps.hr_all_organization_units_tl otl,
apps.hr_organization_information o2,
apps.hr_organization_information o3
WHERE i.complete_flag = 'Y'
AND i.bill_to_customer_id = ca.cust_account_id
AND ca.party_id = p.party_id
AND i.bill_to_site_use_id = csu.site_use_id
AND csu.cust_acct_site_id = cas.cust_acct_site_id
AND cas.party_site_id = ps.party_site_id
AND ps.location_id = loc.location_id
AND o.organization_id = o2.organization_id
AND o.organization_id = o3.organization_id
AND hpu.organization_id = o.organization_id
AND o2.org_information_context || '' = 'CLASS'
AND o3.org_information_context = 'Operating Unit Information'
AND o2.org_information1 = 'OPERATING_UNIT'
AND o2.org_information2 = 'Y'
AND o.organization_id = otl.organization_id
AND p.party_name = '&Cust_Name'
-- AND otl.LANGUAGE = USERENV ('LANG');
ORDER BY p.party_name
---X---
No comments:
“