960: CURSOR l_std_terms_csr (
961: cp_cust_id IN NUMBER,
962: cp_site_use_id IN NUMBER) IS
963: SELECT c.standard_terms standard_terms
964: FROM hz_customer_profiles c
965: WHERE c.cust_account_id = cp_cust_id
966: AND c.site_use_id = cp_site_use_id
967: UNION
968: SELECT c1.standard_terms standard_terms
965: WHERE c.cust_account_id = cp_cust_id
966: AND c.site_use_id = cp_site_use_id
967: UNION
968: SELECT c1.standard_terms standard_terms
969: FROM hz_customer_profiles c1
970: WHERE c1.cust_account_id = cp_cust_id
971: AND c1.site_use_id IS NULL
972: AND NOT EXISTS (
973: SELECT '1'
970: WHERE c1.cust_account_id = cp_cust_id
971: AND c1.site_use_id IS NULL
972: AND NOT EXISTS (
973: SELECT '1'
974: FROM hz_customer_profiles c2
975: WHERE c2.cust_account_id = cp_cust_id
976: AND c2.site_use_id = cp_site_use_id);
977:
978: