SELECT DISTINCT pv.segment1 vendor_number,
pv.vendor_name,
hps.party_site_name address_name,
hou.name operating_unit,
hcp2.email_address,
DECODE (hps.status, 'A', 'Active', 'I', 'Inactive') status
FROM apps.po_vendors pv,
apps.po_vendor_sites_all pvsa,
apps.hr_operating_units hou,
apps.hz_contact_points hcp2,
apps.hz_party_sites hps
WHERE 1 = 1
AND pv.vendor_id = pvsa.vendor_id
AND pvsa.org_id = hou.organization_id
AND hcp2.owner_table_id(+) = pvsa.party_site_id
AND hcp2.contact_point_type(+) = 'EMAIL'
AND hcp2.status(+) = 'A'
AND hcp2.owner_table_name(+) = 'HZ_PARTY_SITES'
AND pvsa.party_site_id = hps.party_site_id
AND (pv.end_date_active IS NULL OR pv.end_date_active > SYSDATE)
ORDER BY pv.segment1
pv.vendor_name,
hps.party_site_name address_name,
hou.name operating_unit,
hcp2.email_address,
DECODE (hps.status, 'A', 'Active', 'I', 'Inactive') status
FROM apps.po_vendors pv,
apps.po_vendor_sites_all pvsa,
apps.hr_operating_units hou,
apps.hz_contact_points hcp2,
apps.hz_party_sites hps
WHERE 1 = 1
AND pv.vendor_id = pvsa.vendor_id
AND pvsa.org_id = hou.organization_id
AND hcp2.owner_table_id(+) = pvsa.party_site_id
AND hcp2.contact_point_type(+) = 'EMAIL'
AND hcp2.status(+) = 'A'
AND hcp2.owner_table_name(+) = 'HZ_PARTY_SITES'
AND pvsa.party_site_id = hps.party_site_id
AND (pv.end_date_active IS NULL OR pv.end_date_active > SYSDATE)
ORDER BY pv.segment1