SELECT LISTAGG(
cont_point.EMAIL_ADDRESS,'|') WITHIN GROUP (ORDER BY cont_point.EMAIL_ADDRESS)
into lv_email_address
FROM hz_contact_points
cont_point,
--hz_contact_points cont_point1,
hz_cust_account_roles acct_role,
hz_parties party,
hz_parties rel_party,
hz_relationships rel,
hz_org_contacts org_cont,
hz_cust_accounts role_acct,
hz_contact_restrictions cont_res,
hz_person_language per_lang,
hz_cust_acct_sites_all hcasa,
hz_cust_site_uses_all hcu
WHERE acct_role.party_id = rel.party_id
AND acct_role.role_type = 'CONTACT'
AND org_cont.party_relationship_id = rel.relationship_id
AND rel.subject_id = party.party_id
AND rel_party.party_id = rel.party_id
AND cont_point.owner_table_id(+) = rel_party.party_id
AND cont_point.contact_point_type(+) = 'EMAIL'
-- AND cont_point1.owner_table_id(+) = rel_party.party_id
--AND cont_point1.contact_point_type = 'EMAIL'
--AND cont_point.phone_line_type =
'GEN'
--and
cont_point.primary_flag(+)
= 'Y'
AND acct_role.cust_account_id = role_acct.cust_account_id
AND role_acct.party_id = rel.object_id
AND party.party_id = per_lang.party_id(+)
AND per_lang.native_language(+) = 'Y'
AND party.party_id = cont_res.subject_id(+)
AND cont_res.subject_table(+) = 'HZ_PARTIES'
AND role_acct.cust_account_id = hcasa.cust_account_id
AND hcasa.cust_acct_site_id = acct_role.cust_acct_site_id
AND hcasa.cust_acct_site_id = hcu.cust_acct_site_id
AND
cont_point.EMAIL_ADDRESS IS NOT NULL
--AND cont_point1.EMAIL_ADDRESS IS NOT NULL
AND hcu.site_use_id = pn_site_use_id --- /*Pass Party Site Use Id */
AND ROWNUM <= 3;
*****Posted By -- Alam (Doyensys)
No comments:
Post a Comment