begin
delete from  rm$tab_groups;
delete from rm$tool_tab_groups;
delete from RM$TAB_TYPE_GROUPS;
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('REF',1,'Y', 'Ref Data','Reference Data Definition');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('BPR',2,'Y','Enterprise Model','Enterprise Modeling');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('ERMOD',3,'Y','E/R Model','Entity/Relationship Modeling');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('DFLMOD',4,'Y','DataFlows','Dataflow Modeling');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('FUNEVT',5,'Y','Fun/Evt Model','Function Event Modeling');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('TABDEF',8,'Y','Server Model','Server Model Definition');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('FILREC',9,'N','Codasyl','Codasyl File / Record Definition');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('MODDES',10,'Y','Modules','Module Design');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('SCHEMA',11,'Y','DB Design','Database and Network Design');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('SETS',12,'N','Sets', 'User Defined Sets and Diagrams');
insert into rm$tab_groups
(name, seq, isdefault, prompt, description)
values ('FILES',13,'Y','Files', 'Files and Folders');
update rm$tab_groups
set user_extension = 'NNY';
insert into rm$tool_tab_groups  (TAB, TOOL) values('REF','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('BPR','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('ERMOD','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('DFLMOD','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('FUNEVT','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('TABDEF','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('FILREC','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('MODDES','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('SCHEMA','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('SETS','RON');
insert into rm$tool_tab_groups  (TAB, TOOL) values('FILES','RON');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq, subtype)
 select id, 'REF',DECODE(short_name,'TER',1,'DOC',2,'DOM',4,'OSP',5,'LAN',6,'DIA',7), 
decode(short_name,'DIA','MXD', NULL) from rm_element_types
where short_name in ('TER','DOC','DOM','OSP','LAN','DIA');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq , subtype)
select id,  'BPR', DECODE(short_name,'BUN',10,'E6',11,'E1',12,'E4',13,'E5',14,'E2',15,'E3',16,'FUN',17,'EVT',18,'DST',19,'ENT',20,'DIA',21),
decode(short_name,'DIA','BPA', NULL)
from rm_element_types
where short_name in ('DIA','ENT','E5','E1','E4','BUN','E3','E2','E6','FUN','EVT','DST');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq , subtype)
select id, 'ERMOD', 
DECODE(short_name,'ENT',30,'ERD',33),
decode(short_name,'DIA','ERD', NULL)
from rm_element_types
where short_name in ('DIA','ENT');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq, subtype )
select id, 'DFLMOD',
DECODE(short_name,'DFL',40, 'DIT',41,'DST', 42,'EXT',43,'FUN', 44,'DIA',45, 99),
decode(short_name,'DIA','DFD', NULL)
from rm_element_types
where short_name in ('DIA','EXT','DST','DIT','FUN','DFL');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq, subtype )
select id, 'FUNEVT',
DECODE(short_name,'FUN',50,'EVT',51,'DIA',52),  
decode(short_name,'DIA','FHD', NULL) from rm_element_types
where short_name in('DIA','EVT','FUN');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq , subtype)
select id, 'MODDES',
DECODE(short_name, 'RMC',60,'RLV',61,'GEM',62,'PRS',63,'DIA',64),
decode(short_name,'DIA','MDD', NULL)
from rm_element_types
where short_name in('DIA','RMC','RLV','GEM','PRS');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq )
select id, 'FILREC',
DECODE(short_name,'RFI',65,'RECORD',66) from rm_element_types
where short_name in('RFI','RECORD');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq, subtype )
select id, 'TABDEF', 
DECODE(short_name, 'TBL',70,'VW',71,'SNP',72,'OCL',73,'OSQ',74, 'PLM',75,'JAM',76 ,'OOT',76, 'OCT', 78, 'DIA', 79),
decode(short_name,'DIA','DSD', NULL)
from rm_element_types
where short_name in('DIA','TBL','VW','SNP','PLM','JAM','OCL','OSQ','OOT','OCT');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq )
select id,  'SCHEMA',
DECODE(short_name,'ORC',90, 'ANS', 91, 'COM',92, 'E20',93 ) from rm_element_types
where short_name in('ORC','ANS','COM','E20');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq )
select id, 'SETS', DECODE(short_name,'UDS',1,'DIA',2 )
from rm_element_types
where short_name in('UDS', 'DIA');
insert into RM$TAB_TYPE_GROUPS
( type_id, tab, seq )
select id,  'FILES',  1 from rm_element_types
where short_name in('FILES');
end;
/
