Amazon

TCA Architecture Query

SELECT /*+ opt_param('optimizer_index_cost_adj',1) */
       hp.party_name,rownum line_num, hca.cust_account_id customer_id,
          bill_loc.address1
       || DECODE (bill_loc.address2,
                  NULL, bill_loc.address2,
                  ', ' || bill_loc.address2
                 )
       || DECODE (bill_loc.address3,
                  NULL, bill_loc.address3,
                  ', ' || bill_loc.address3
                 )
       || DECODE (bill_loc.address4,
                  NULL, bill_loc.address4,
                  ', ' || bill_loc.address4
                 ) bill_to_address,
          bill_loc.city
       || DECODE (bill_loc.postal_code,
                  NULL, bill_loc.postal_code,
                  '-' || bill_loc.postal_code
                 ) bill_to_address1,
       bill_ps.party_site_name bill_to_site,
       ship_loc.address1 ship_to_address,
          DECODE (ship_loc.address2,
                  NULL, ship_loc.address2,
                  ', ' || ship_loc.address2
                 )
       || DECODE (ship_loc.address3,
                  NULL, ship_loc.address3,
                  ', ' || ship_loc.address3
                 )
       || DECODE (ship_loc.address4,
                  NULL, ship_loc.address4,
                  ', ' || ship_loc.address4
                 ) ship_to_address1,
          ship_loc.city
       || DECODE (ship_loc.postal_code,
                  NULL, ship_loc.postal_code,
                  '-' || ship_loc.postal_code
                 ) ship_to_address2
  FROM hz_cust_accounts hca,
       hz_cust_acct_sites_all bill_cas,
       hz_cust_site_uses_all bill_su,
       hz_parties hp,
       hz_party_sites bill_ps,
       hz_locations bill_loc,
------------------------------------
       hz_cust_acct_sites_all ship_cas,
       hz_cust_site_uses_all ship_su,
       hz_party_sites ship_ps,
       hz_locations ship_loc
 WHERE 1 = 1
   AND hca.CUST_ACCOUNT_ID=3102
   AND hca.cust_account_id = bill_cas.cust_account_id
   AND bill_su.cust_acct_site_id = bill_cas.cust_acct_site_id
   AND bill_su.site_use_code = 'BILL_TO'
   AND hp.party_id = hca.party_id
   AND bill_cas.party_site_id = bill_ps.party_site_id
   AND bill_loc.location_id = bill_ps.location_id
   AND hca.cust_account_id = ship_cas.cust_account_id
   AND ship_su.cust_acct_site_id = ship_cas.cust_acct_site_id
   AND ship_cas.party_site_id = ship_ps.party_site_id
   AND ship_loc.location_id = ship_ps.location_id
   AND ship_su.site_use_code = 'SHIP_TO'

No comments:

Post a Comment