SELECT site_uses.status, SUBSTRB (party.party_name, 1, 50) customer_name,
cust.account_number customer_number,
SUBSTRB (look.meaning, 1, 8) site_use,
acct_site.cust_acct_site_id address_id,
SUBSTRB (loc.address1, 1, 30) address_line_1,
SUBSTRB (loc.city, 1, 15) city, SUBSTRB (loc.state, 1, 2) state,
SUBSTRB (loc.postal_code, 1, 10) zip_code, cust.status cust_status,
acct_site.*, site_uses.*
FROM ar_lookups look,
ar_lookups look_status,
hz_cust_accounts_all cust,
hz_parties party,
hz_cust_site_uses_all site_uses,
hz_cust_acct_sites_all acct_site,
hz_party_sites party_site,
hz_locations loc
WHERE cust.cust_account_id = acct_site.cust_account_id
AND cust.party_id = party.party_id
AND acct_site.party_site_id = party_site.party_site_id(+)
AND loc.location_id(+) = party_site.location_id
AND acct_site.cust_acct_site_id = site_uses.cust_acct_site_id(+)
AND look.lookup_type(+) = 'SITE_USE_CODE'
AND look.lookup_code(+) = site_uses.site_use_code
AND look_status.lookup_type(+) = 'CODE_STATUS'
AND look_status.lookup_code(+) = NVL (cust.status, 'A')
AND SUBSTRB (look.meaning, 1, 8) = 'Bill To'
AND site_uses.site_use_id = 1088
ORDER BY party.party_name;
cust.account_number customer_number,
SUBSTRB (look.meaning, 1, 8) site_use,
acct_site.cust_acct_site_id address_id,
SUBSTRB (loc.address1, 1, 30) address_line_1,
SUBSTRB (loc.city, 1, 15) city, SUBSTRB (loc.state, 1, 2) state,
SUBSTRB (loc.postal_code, 1, 10) zip_code, cust.status cust_status,
acct_site.*, site_uses.*
FROM ar_lookups look,
ar_lookups look_status,
hz_cust_accounts_all cust,
hz_parties party,
hz_cust_site_uses_all site_uses,
hz_cust_acct_sites_all acct_site,
hz_party_sites party_site,
hz_locations loc
WHERE cust.cust_account_id = acct_site.cust_account_id
AND cust.party_id = party.party_id
AND acct_site.party_site_id = party_site.party_site_id(+)
AND loc.location_id(+) = party_site.location_id
AND acct_site.cust_acct_site_id = site_uses.cust_acct_site_id(+)
AND look.lookup_type(+) = 'SITE_USE_CODE'
AND look.lookup_code(+) = site_uses.site_use_code
AND look_status.lookup_type(+) = 'CODE_STATUS'
AND look_status.lookup_code(+) = NVL (cust.status, 'A')
AND SUBSTRB (look.meaning, 1, 8) = 'Bill To'
AND site_uses.site_use_id = 1088
ORDER BY party.party_name;
No comments:
Post a Comment