You are on page 1of 6

R12�ͻ���ṹ����

�ͻ���/�ϵ��/PARTY���
HZ_PARTIES

�ͻ��˻���
HZ_CUST_ACCOUNTS

���ӣ�

select hp.party_number --�ͻ�‫���ע‬ ʶ


,
hp.party_name --��֯��
/�ͻ�
,
hp.known_as --����
,
hp.organization_name_phonetic --���ƴ��
,
acc.account_number --�ʺ�
,
flv_sale.meaning sales_channel_code --�������
,
acc.account_name --�˼�˵��
,
flv_customer.meaning customer_class_code --����
,
acc.orig_system_reference --�ο�
,
flv_status.meaning status --̬‫״‬
,
flv_type.meaning customer_type --�˻�����
,
acc.attribute_category --������
,
acc.attribute1 --‫��ע‬
,
acc.attribute2 --��Ա�ƹ�
,
acc.attribute3 --����Ҫ��
,
acc.attribute4 --�����Ƿ��ӡ�۸�
,
acc.attribute5 --��������
from hz_parties hp,
hz_cust_accounts acc,
fnd_lookup_values flv_sale --�������
,
fnd_lookup_values flv_customer --����
,
fnd_lookup_values flv_status --̬‫״‬
,
fnd_lookup_values flv_type --�˻�����
where hp.party_id = acc.party_id
and acc.sales_channel_code = flv_sale.lookup_code
and flv_sale.lookup_type = 'SALES_CHANNEL'
and flv_sale.language = userenv('LANG')
and acc.customer_class_code = flv_customer.lookup_code
and flv_customer.lookup_type = 'CUSTOMER CLASS'
and flv_customer.language = userenv('LANG')
and acc.status = flv_status.lookup_code
and flv_status.lookup_type = 'HZ_CPUI_REGISTRY_STATUS'
and flv_status.language = userenv('LANG')
and acc.customer_type = flv_type.lookup_code
and flv_type.lookup_type = 'CUSTOMER_TYPE'
and flv_type.language = userenv('LANG')
and hp.party_id = hz_parties.party_id;

�ʻ������ļ�
HZ_CUSTOMER_PROFILES
�ֶ�
cust_account_role_id --oe_order_headers.sold_to_contract_id
cust_account_id
site_use_id --�ͻ�ͷ�ĸ��ֶ�Ϊ��
--�ͻ��‫��ص‬Ϊhz_cust_site_uses_all.site_use_id

�����ļ����
HZ_CUST_PROFILE_AMTS --�ͻ�ͷ��/�ͻ��‫��ص‬
�����hz_customer_profiles.cust_account_profile_id

�ͻ��ϵ��
HZ_CUST_ACCOUNT_ROLES --�ͻ�ͷ��/�‫��ص‬
cust_account_id
cust_acct_site_id --ͷ����ֶ�Ϊ��
party_id --����Ϊ PARTY_RELATIONSHIP �� PARTY_ID
role_type --CONTACT
��ͷ����ϵ��Ϊ��

select hp_per.*
from hz_cust_account_roles rol,
hz_parties hp_rel,
hz_relationships rel,
hz_parties hp_per
where rol.party_id = hp_rel.party_id
and hp_rel.party_id = rel.party_id
and rel.object_type = 'PERSON'
and rel.relationship_code = 'CONTACT'
and rel.object_id = hp_per.party_id
and rol.cust_acct_site_id is null --ͷ��
and rol.cust_account_id = hz_cust_accounts.cust_account_id;
�ϵ��ʽ
HZ_CONTACT_POINTS
�ֶ�
owner_table_name HZ_PARTIES/HZ_PARTY_SITES
owner_table_id PARTY_ID/PARTY_SITE_ID
�ͻ��‫����ص‬ϵ��ʽ��ֱ����party_site_id ��� owner_table_id ����
�ͻ�ͷ����ϵ��ʽ��Ҫ�� HZ_RELATIONSHIPS ��‫��ת‬һ�£��� hz_relationships.party_id ���
�ͻ��ϵ��������ϵ��ʽ��Ҫ��HZ_CUST_ACCOUNT_ROLES��PARTY_ID���owner_table_id
���ӣ�
�ͻ�ͷ��

select con.*
from hz_parties hp,
hz_relationships rel,
hz_contact_points con
where hp.party_id = rel.subject_id
and rel.subject_type = 'ORGANIZATION'
and rel.party_id = con.owner_table_id
and con.owner_table_name = 'HZ_PARTIES'
and hp.party_id = hz_parties.party_id;

--�ͻ��‫��ص‬
select *
from hz_contact_points con
where con.owner_table_id = hz_party_sites.party_site_id;
--�ͻ��ϵ���µ��ϵ��ʽ
select *
from hz_contact_points c
where c.owner_table_id = hz_cust_account_roles.party_id

�ͻ���˰
HZ_CODE_ASSIGNMENTS ��Ʒ���/�ͻ�ͷ��/�‫��ص‬
�ֶ�
OWNER_TABLE_NAME �������/'ZX_PARTY_TAX_PROFILE'
OWNER_TABLE_ID ��������/PARTY_TAX_PROFILE_ID
CLASS_CODE ��Ʒ������

ZX_PARTY_TAX_PROFILE ��Ӧ�̵�˰�������ļ�
�ֶ�
PARTY_TYPE_CODE ���� THIRD_PARTY/THIRD_PARTY_SITE
PARTY_ID ����� HZ_PARTIES/HZ_PARTY_SITES
ͷ��: PARTY_TYPE_CODE = 'THIRD_PARTY'
AND PARTY_ID = HZ_PARTIES.PARTY_ID
�‫��ص‬ : PARTY_TYPE_CODE = 'THIRD_PARTY_SITE'
AND PARTY_ID = HZ_PARTY_SITES.PARTY_SITE_ID
REP_REGISTRATION_NUMBER ��˰�ǼDZ��
PARTY_TAX_PROFILE_ID ���
HZ_CLASS_CODE_DENORM ��Ʒ�������

ZX_EXEMPTIONS �ͻ���˰/ �ͻ�ͷ��/�‫��ص‬


�ֶ�
PARTY_TAX_PROFILE_ID ��� ZX_PARTY_TAX_PROFILE.PARTY_TAX_PROFILE_ID

�ͻ��‫�ص‬
HZ_PARTY_SITES

�‫ַ��ص‬
HZ_LOCATIONS

�ͻ��‫��ص‬ʻ���
HZ_CUST_ACCT_SITES_ALL

�ͻ��‫�ص‬ҵ��Ŀ��
HZ_CUST_SITE_USES_ALL

���ɷ���
HZ_CUSTOMER_PROFILES

--�����۶�������ͻ��ṹ
select h.sold_from_org_id, --ҵ��ʵ��/ORG ID
h.sold_to_org_id, --�ͻ�
h.ship_from_org_id, --����ֿ�
h.ship_to_org_id, --�ջ�
h.invoice_to_org_id,
h.sold_to_contact_id
from oe_order_headers_all h;--ҵ��ʵ��

select org.name
from hr_organization_units org
where org.organization_id = oe_order_headers_all.sold_from_org_id;

--�ͻ�
select hz.party_name
from hz_cust_accounts acc,
hz_parties hz
where acc.party_id = hz.party_id
and acc.cust_account_id = oe_order_headers_all.sold_to_org_id;

--����ֿ�
select para.organization_code,
para.*
from mtl_parameters para
where para.organization_id = oe_order_headers_all.ship_from_org_id;

select *
from org_organization_definitions org
where org.organization_id = oe_order_headers_all.ship_from_org_id;

--�‫���ص‬ϸ��Ϣ
select loc.*
from hz_parties hp,
hz_party_sites hps,
hz_locations loc
where hp.party_id = hps.party_id
and hps.location_id = loc.location_id
and hp.party_id = 5042;

--ҵ��Ŀ��
select hp.party_name --�ͻ�
,
hp.party_number --‫����ע‬ʶ
,
uses.site_use_code,
acnt.account_number --�˺�
,
flv.meaning businesspurpose --ҵ��Ŀ��
,
uses.location --�‫�ص‬
,
acnt.account_name --�ʻ�˵��
,
decode(loc.address1, null, loc.address1, loc.address1 || ',') ||
decode(loc.city, null, loc.city, loc.city || ',') ||
decode(loc.state, null, loc.state, loc.state || ',') ||
decode(loc.postal_code, null, ' ', loc.postal_code) address --�‫ַ��ص‬
,
hps.party_site_number --�‫��˵�ص‬
,
uses.payment_term_id --������
,
site.cust_acct_site_id,
acnt.cust_account_id,
uses.site_use_id
from hz_parties hp,
hz_cust_accounts acnt,
hz_cust_acct_sites_all site,
hz_cust_site_uses_all uses,
hz_party_sites hps,
hz_locations loc,
fnd_lookup_values flv
where hp.party_id = acnt.party_id
and acnt.cust_account_id = site.cust_account_id
and site.cust_acct_site_id = uses.cust_acct_site_id
and hps.party_site_id = site.party_site_id
and loc.location_id = hps.location_id
and uses.site_use_code = flv.lookup_code
and flv.lookup_type = 'SITE_USE_CODE'
and flv.language = userenv('LANG')
and hp.party_id = 5042
and hps.party_site_id = 3023;
--�ϵ�˵绰/�‫��ص‬
select phone.phone_number
from hz_contact_points phone
where phone.owner_table_name = 'HZ_PARTY_SITES'
and phone.owner_table_id = :hz_party_sites.party_sites_id;

--�ϵ��/�‫��ص‬
select hpsub.party_name
from hz_cust_account_roles hcar,
hz_relationships hr,
hz_parties hpsub
where hcar.party_id = hr.party_id
and hr.subject_id = hpsub.party_id
and hcar.role_type = 'CONTACT'
and hr.directional_flag = 'F'
and hcar.cust_account_role_id = :oe_order_headers_all.sold_to_contact_id
and hpsub.status = 'A';

You might also like