15: -- should fetch one row of purpose_id
16: CURSOR C_purpose IS
17: select a.default_rule_set_id
18: , a.rule_set_level
19: from fa_asset_hierarchy_purpose a
20: , fa_asset_hierarchy b
21: where a.asset_hierarchy_purpose_id = b.asset_hierarchy_purpose_id
22: and b.asset_hierarchy_id = x_parent_node_id
23: and a.book_type_code = x_book_type_code ;
30: and p_rule_set_level = 'ASSET_CATEGORY'
31: UNION
32: select a.hierarchy_rule_set_id
33: from fa_asset_hierarchy a
34: , fa_asset_hierarchy_purpose b
35: where a.asset_hierarchy_purpose_id = b.asset_hierarchy_purpose_id
36: and a.asset_hierarchy_id = x_parent_node_id
37: and b.book_type_code = x_book_type_code
38: and p_rule_set_level = 'TOP_NODE'
42: from fa_asset_hierarchy
43: where parent_hierarchy_id IS NULL
44: start with asset_hierarchy_id = x_parent_node_id
45: connect by prior asset_hierarchy_id = parent_hierarchy_id ) a
46: , fa_asset_hierarchy_purpose b
47: where a.asset_hierarchy_purpose_id = b.asset_hierarchy_purpose_id
48: and b.book_type_code = x_book_type_code
49: and p_rule_set_level = 'LOWEST_NODE';
50: