Ship to customer query
- 1. select NVL(SHIP_ACCT_SITE.TRANSLATED_CUSTOMER_NAME,SHIP_PARTY.PARTY_NAME)
SHIP_CUSTOMER,
ship_cust_acct.ACCOUNT_NUMBER ship_CUSTOMER_NUMBER,
ltrim(ship_loc.address1) s_address1,
ltrim(ship_loc.address2) s_address2,
ltrim(ship_loc.address3) s_address3,
ltrim(ship_loc.address4) s_address4,
ship_loc.city
||DECODE(ship_loc.city,NULL,NULL, DECODE(ship_loc.state,NULL,NULL,', '
||ship_loc.state))
||DECODE (ship_loc.province,NULL,NULL,', '
||ship_loc.province)
||' '
|| ship_loc.postal_code s_city_st_zip,
ship_loc.country s_country,
terr2.territory_short_name s_country_name,
DECODE(SHIP_PARTY.JGZZ_FISCAL_CODE,null, SHIP_SU.TAX_REFERENCE,
SHIP_PARTY.JGZZ_FISCAL_CODE) CUST_TAX_ID
from hz_party_sites ship_party_site,
hz_loc_assignments ship_loc_assign,
hz_locations ship_loc,
hz_cust_acct_sites_all ship_acct_site,
HZ_PARTIES SHIP_PARTY,
hz_cust_accounts ship_cust_acct,fnd_territories_vl terr2,ra_site_uses_all
ship_su
where 1=1
AND ship_su.address_id
AND ship_acct_site.party_site_id
AND ship_acct_site.cust_account_id
and SHIP_LOC.LOCATION_ID(+)
and SHIP_LOC.LOCATION_ID
and SHIP_LOC.COUNTRY
AND ship_cust_acct.party_id
and ship_su.site_use_code='SHIP_TO';
=
=
=
=
=
=
=
ship_acct_site.cust_acct_site_id
ship_party_site.party_site_id
ship_cust_acct.cust_account_id
SHIP_PARTY_SITE.LOCATION_ID
SHIP_LOC_ASSIGN.LOCATION_ID
TERR2.TERRITORY_CODE
ship_party.party_id