576: CURSOR catchall_cust(l_terr_group_id number) IS
577: SELECT distinct b.comparison_operator
578: ,b.value1_char
579: from jtf_tty_terr_grp_accts a
580: , jtf_tty_acct_qual_maps b
581: where a.named_account_id = b.named_account_id
582: and a.terr_group_id = l_terr_group_id
583: and b.qual_usg_id = -1012
584: order by b.comparison_operator,b.value1_char;
637: and a.status = 'A'
638: and exists (
639: /* Named Account has at least 1 Mapping Rule */
640: SELECT 1
641: from jtf_tty_acct_qual_maps d
642: where d.named_account_id = c.named_account_id )
643: AND EXISTS (
644: /* Salesperson exists for this Named Account */
645: SELECT NULL
691: and a.status = 'A'
692: and exists (
693: /* Named Account has at least 1 Mapping Rule */
694: SELECT 1
695: from jtf_tty_acct_qual_maps d
696: where d.named_account_id = c.named_account_id )
697: AND EXISTS (
698: /* Salesperson, with Role that has a Product
699: ** Interest defined, exists for this Named Account */
717: SELECT b.qual_usg_id
718: , b.comparison_operator
719: , b.value1_char
720: , b.value2_char
721: FROM jtf_tty_acct_qual_maps b
722: WHERE b.qual_usg_id IN (-1007, -1012)
723: AND b.named_account_id = l_na_id
724: ORDER BY b.qual_usg_id;
725: