35: CURSOR c_insert_prim IS ( SELECT p.ATTRIBUTE_ID FROM
36: (SELECT unique p1.ATTRIBUTE_ID
37: FROM HZ_MATCH_RULE_PRIMARY p1
38: WHERE p1.match_rule_id in (Select unique condition_match_rule_id
39: from hz_match_rule_conditions
40: where match_rule_set_id = p_mrule_set_id)
41: UNION
42: (SELECT unique attribute_id
43: from hz_match_rule_conditions
39: from hz_match_rule_conditions
40: where match_rule_set_id = p_mrule_set_id)
41: UNION
42: (SELECT unique attribute_id
43: from hz_match_rule_conditions
44: where match_rule_set_id = p_mrule_set_id
45: and attribute_id is not null
46: )
47: ) p
61: MINUS
62: (SELECT unique p1.ATTRIBUTE_ID
63: FROM HZ_MATCH_RULE_PRIMARY p1
64: WHERE p1.match_rule_id in (Select unique condition_match_rule_id
65: from hz_match_rule_conditions
66: where match_rule_set_id = p_mrule_set_id)
67: UNION
68: (SELECT unique attribute_id
69: from hz_match_rule_conditions
65: from hz_match_rule_conditions
66: where match_rule_set_id = p_mrule_set_id)
67: UNION
68: (SELECT unique attribute_id
69: from hz_match_rule_conditions
70: where match_rule_set_id = p_mrule_set_id
71: and attribute_id is not null
72: )
73: )
74: );
75: CURSOR c_insert_sec IS ( SELECT s1.ATTRIBUTE_ID
76: FROM HZ_MATCH_RULE_SECONDARY s1
77: WHERE s1.match_rule_id in (Select unique condition_match_rule_id
78: from hz_match_rule_conditions
79: where match_rule_set_id = p_mrule_set_id)
80: AND NOT EXISTS(SELECT 1 FROM HZ_MATCH_RULE_SECONDARY s2
81: WHERE s2.match_rule_id = p_mrule_set_id
82: AND s2.ATTRIBUTE_ID = s1.ATTRIBUTE_ID
92: MINUS
93: SELECT unique s1.ATTRIBUTE_ID
94: FROM HZ_MATCH_RULE_SECONDARY s1
95: WHERE s1.match_rule_id in (Select unique condition_match_rule_id
96: from hz_match_rule_conditions
97: where match_rule_set_id = p_mrule_set_id)
98: );
99:
100: TYPE t_attr_id_list IS TABLE OF NUMBER index by binary_integer;
197: v_attr_order_list t_prim_attr_list;
198:
199: CURSOR c_prim_attr IS
200: SELECT unique attribute_id,0 display_order
201: from hz_match_rule_conditions
202: where match_rule_set_id = p_mrule_set_id
203: and attribute_id is not null
204: UNION
205: SELECT p1.ATTRIBUTE_ID,min(nvl(p1.display_order,l_g_miss_num)) display_order
204: UNION
205: SELECT p1.ATTRIBUTE_ID,min(nvl(p1.display_order,l_g_miss_num)) display_order
206: FROM HZ_MATCH_RULE_PRIMARY p1
207: WHERE EXISTS (Select 1
208: from hz_match_rule_conditions cond1
209: where cond1.match_rule_set_id = p_mrule_set_id
210: and cond1.condition_match_rule_id = p1.match_rule_id
211: )
212: AND NOT EXISTS (SELECT 1 from hz_match_rule_conditions cond2
208: from hz_match_rule_conditions cond1
209: where cond1.match_rule_set_id = p_mrule_set_id
210: and cond1.condition_match_rule_id = p1.match_rule_id
211: )
212: AND NOT EXISTS (SELECT 1 from hz_match_rule_conditions cond2
213: where cond2.match_rule_set_id = p_mrule_set_id
214: and cond2.attribute_id = p1.attribute_id
215: )
216: group by p1.ATTRIBUTE_ID;
242: CURSOR c_sec_attr IS
243: SELECT s1.ATTRIBUTE_ID,min(nvl(s1.display_order,l_g_miss_num)) display_order
244: FROM HZ_MATCH_RULE_SECONDARY s1
245: WHERE EXISTS (Select 1
246: from hz_match_rule_conditions cond1
247: where cond1.match_rule_set_id = p_mrule_set_id
248: and cond1.condition_match_rule_id = s1.match_rule_id
249: )
250: group by s1.ATTRIBUTE_ID;