select ooh.order_number, hca.account_number, hp.party_name
from oe_order_headers_all ooh,
hz_cust_site_uses_all hcsua, -- uses of customer addresses
HZ_CUST_ACCT_SITES_ALL hcasa, -- customer addresses
hz_cust_accounts hca, -- customer accounts
hz_parties hp -- parties
where ooh.ship_to_org_id = hcsua.site_use_id -- or a.invoice_to_org_id
and hcsua.cust_acct_site_id = hcasa.cust_acct_site_id
and hcasa.cust_account_id = hca.cust_account_id
and hca.party_id = hp.party_id
and ooh.order_number = P_order_number
請先 登入 以發表留言。