SELECT hc.account_number
, hp.party_name
, location_id
, acct_site.cust_acct_site_id
, hpsv.address1
|| hpsv.address2
|| hpsv.address3
|| hpsv.address4 address
, hpsv.city
, hpsv.state
, hpsv.postal_code
FROM hz_cust_site_uses_all site
, apps.hz_cust_accounts_all hc
, hz_parties hp
, hz_cust_acct_sites_all acct_site
, apps.hz_party_sites_v hpsv
WHERE site.site_use_code = 'BILL_TO'
AND hpsv.site_use_type = site.site_use_code
AND site.cust_acct_site_id = acct_site.cust_acct_site_id
AND hc.party_id = hp.party_id
AND site.org_id = acct_site.org_id
AND acct_site.party_site_id = hpsv.party_site_id
AND hpsv.party_id = hp.party_id
AND site.primary_flag = 'Y'
AND hc.cust_account_id = acct_site.cust_account_id
AND hc.status = 'A'
AND acct_site.status = 'A'
AND site.status = 'A'
AND hpsv.status = 'A'
AND UPPER (hp.party_name) LIKE '%' || UPPER (p_party_name) || '%'
AND UPPER (hpsv.address1) LIKE '%' || UPPER (p_party_address) || '%'
AND UPPER (hpsv.city) = UPPER (p_city)
AND UPPER (hpsv.state) = UPPER (p_state)
AND hpsv.postal_code = p_postal_code
No comments:
Post a Comment