...
Find the next instance for dictionary_id:
SELECT * FROM NEXT_INSTANCE WHERE TABLE_NAME LIKE 'RULESDBO.DICTIONARIES
Insert into the dictionary_table using dictionary_id from the last query + 1:
insert into rulesdbo.dictionaries ( Dictionary_ID, Dictionary_name, Dictionary_type, UPDATE_DATE )values ( 4, 'Mutual Fund Perf Model', 'P', SYSDATE)INSERT INTO RULESDBO.DICTIONARY_FORMAT
( Dictionary_ID, Dictionary_Level, Field_attribute_ID, Dictionary_Level_Desc)VALUES(4, 1, -1, 'TOTAL')Find the next instance for dictionary_detail_id:
SELECT * FROM NEXT_INSTANCE WHERE TABLE_NAME = 'RULESDBO.DICTIONARY_DETAIL' ;Add 1 to the result and insert into dictionary_detail:INSERT INTO RULESDBO.DICTIONARY_DETAIL(Dictionary_ID, Dictionary_Detail_id, Dict_L1_Code_value, Dict_L2_Code_value, DictDictL3_L3_Code_value, dictionary_item_id, SOURCE_CODE_ID) VALUES (4,2, ' TOTAL', NULL, NULL , 1, 10)
Update the NEXT_INSTANCE table:
UPDATE NEXT_INSTANCE
SET NEXT_INST = ( NEXT_INST + 1)WHERE TABLE_NAME IN( 'RULESDBO.DICTIONARIES', 'RULESDBO.DICTIONARY_DETAIL' ) ;