SELECT DISTINCT asp.vendor_id ,
asp.segment1 AS supplier_number ,
asp.vendor_name ,
ass.vendor_site_code ,
hou.name ,
ass.address_line1 ,
ass.city ,
ass.state ,
ass.zip ,
ass.country ,
ass.phone ,
person.person_first_name ,
person.person_last_name ,
pty_rel.primary_phone_number ,
(SELECT hcp5.phone_area_code
FROM hz_contact_points HCP5
WHERE HCP5.owner_table_name = 'HZ_PARTIES'
AND APSC.REL_PARTY_ID = HCP5.OWNER_TABLE_ID
AND HCP5.CONTACT_POINT_TYPE = 'PHONE'
AND HCP5.PHONE_LINE_TYPE = 'FAX'
AND HCP5.PRIMARY_FLAG = 'N'
AND ROWNUM < 2
) FAX_AREA_CODE,
(SELECT HCP6.PHONE_NUMBER
FROM HZ_CONTACT_POINTS HCP6
WHERE HCP6.OWNER_TABLE_NAME = 'HZ_PARTIES'
AND APSC.REL_PARTY_ID = HCP6.OWNER_TABLE_ID
AND HCP6.CONTACT_POINT_TYPE = 'FAX'
AND HCP6.PRIMARY_FLAG = 'N'
AND ROWNUM < 2
) FAX,
pty_rel.EMAIL_ADDRESS
FROM AP_SUPPLIERS ASP ,
AP_SUPPLIER_SITES_ALL ASS,
AP_SUPPLIER_CONTACTS APSC,
hz_parties person ,
hz_parties pty_rel ,
HR_ALL_ORGANIZATION_UNITS hou
WHERE 1 =1
AND ass.vendor_id = asp.vendor_id
AND apsc.per_party_id = person.party_id
AND apsc.rel_party_id = pty_rel.party_id
AND ass.org_id = hou.organization_id
AND apsc.org_party_site_id = ass.party_site_id
AND hou.name = 'ABCD'
ORDER BY HOU.NAME;
asp.segment1 AS supplier_number ,
asp.vendor_name ,
ass.vendor_site_code ,
hou.name ,
ass.address_line1 ,
ass.city ,
ass.state ,
ass.zip ,
ass.country ,
ass.phone ,
person.person_first_name ,
person.person_last_name ,
pty_rel.primary_phone_number ,
(SELECT hcp5.phone_area_code
FROM hz_contact_points HCP5
WHERE HCP5.owner_table_name = 'HZ_PARTIES'
AND APSC.REL_PARTY_ID = HCP5.OWNER_TABLE_ID
AND HCP5.CONTACT_POINT_TYPE = 'PHONE'
AND HCP5.PHONE_LINE_TYPE = 'FAX'
AND HCP5.PRIMARY_FLAG = 'N'
AND ROWNUM < 2
) FAX_AREA_CODE,
(SELECT HCP6.PHONE_NUMBER
FROM HZ_CONTACT_POINTS HCP6
WHERE HCP6.OWNER_TABLE_NAME = 'HZ_PARTIES'
AND APSC.REL_PARTY_ID = HCP6.OWNER_TABLE_ID
AND HCP6.CONTACT_POINT_TYPE = 'FAX'
AND HCP6.PRIMARY_FLAG = 'N'
AND ROWNUM < 2
) FAX,
pty_rel.EMAIL_ADDRESS
FROM AP_SUPPLIERS ASP ,
AP_SUPPLIER_SITES_ALL ASS,
AP_SUPPLIER_CONTACTS APSC,
hz_parties person ,
hz_parties pty_rel ,
HR_ALL_ORGANIZATION_UNITS hou
WHERE 1 =1
AND ass.vendor_id = asp.vendor_id
AND apsc.per_party_id = person.party_id
AND apsc.rel_party_id = pty_rel.party_id
AND ass.org_id = hou.organization_id
AND apsc.org_party_site_id = ass.party_site_id
AND hou.name = 'ABCD'
ORDER BY HOU.NAME;
No comments:
Post a Comment