Index: openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql	18 Feb 2003 20:53:45 -0000	1.2
+++ openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql	13 Mar 2003 20:22:57 -0000	1.3
@@ -352,22 +352,23 @@
     p_rel_type in acs_rels.rel_type%TYPE
   )
   is
-    v_segment_id rel_segments.segment_id%TYPE;
   begin
 
     add_one(p_party_id, p_member_id);
 
     -- if the relation type is mapped to a relational segment map that too
 
-    select segment_id into v_segment_id
-    from rel_segments s
-    where s.rel_type = p_rel_type
-      and s.group_id = p_party_id;
+    for v_segments in (select segment_id
+                       from rel_segments
+                       where group_id = p_party_id
+                         and rel_type in (select object_type
+                                          from acs_object_types
+                                          start with object_type = p_rel_type
+                                          connect by prior supertype = object_type))
+    loop
+      add_one(v_segments.segment_id, p_member_id);
+    end loop;
 
-    exception when no_data_found then return;
-
-    add_one(v_segment_id, p_member_id);
-
   end add;
 
   procedure remove_one (
@@ -395,22 +396,23 @@
     p_rel_type in acs_rels.rel_type%TYPE
   )
   is
-    v_segment_id rel_segments.segment_id%TYPE;
   begin
 
     remove_one(p_party_id, p_member_id);
 
     -- if the relation type is mapped to a relational segment unmap that too
 
-    select segment_id into v_segment_id
-    from rel_segments s
-    where s.rel_type = p_rel_type
-      and s.group_id = p_party_id;
+    for v_segments in (select segment_id
+                       from rel_segments
+                       where group_id = p_party_id
+                         and rel_type in (select object_type
+                                          from acs_object_types
+                                          start with object_type = p_rel_type
+                                          connect by prior supertype = object_type))
+    loop
+      remove_one(v_segments.segment_id, p_member_id);
+    end loop;
 
-    exception when no_data_found then return;
-
-    remove_one(v_segment_id, p_member_id);
-
   end remove;
 
 end party_approved_member;
