-- --------------------------------------------------------------- LOADING OF DATA: load_entry
--                                                                               1999.04.22 ft
--
update LOAD_ENTRY set entry_name           ='not filled on'||SYSDATE where entry_name is NULL;
update LOAD_ENTRY set entry_acronym        ='not filled'  where entry_acronym         is NULL;
update LOAD_ENTRY set creation_date        = SYSDATE      where creation_date         is NULL;
update LOAD_ENTRY set review_date          = SYSDATE      where review_date           is NULL;
update LOAD_ENTRY set future_review_date   = SYSDATE      where future_review_date    is NULL;
update LOAD_ENTRY set project_acronym      ='*not filled' where project_acronym       is NULL;
update LOAD_ENTRY set progress_descr       ='*not filled' where progress_descr        is NULL;
update LOAD_ENTRY set summary_id           = SEQ_SUMMARY.nextval where summary_id     is NULL;
update LOAD_ENTRY set summary              ='not filled'  where summary               is NULL;
update LOAD_ENTRY set quality_id           = SEQ_QUALITY.nextval where quality_id     is NULL;
update LOAD_ENTRY set accuracy_report      ='not filled'  where accuracy_report       is NULL;
update LOAD_ENTRY set consistency_report   ='not filled'  where consistency_report    is NULL;
update LOAD_ENTRY set completeness_report  ='not filled'  where completeness_report   is NULL;
update LOAD_ENTRY set horizontal_acc_report='not filled'  where horizontal_acc_report is NULL;
update LOAD_ENTRY set vertical_acc_report  ='not filled'  where vertical_acc_report   is NULL;
update LOAD_ENTRY set entry_type           ='not filled'  where entry_type            is NULL;
update LOAD_ENTRY set entry_type_descr     ='not filled'  where entry_type_descr      is NULL;
--
-- ------------------- summary (identical summaries are not united but are stored separately):
insert into SUMMARY (summary_id, summary)
  select             summary_id, summary
  from load_entry;
--
-- ------------- quality (identical quality records are not united but are stored separately):
insert into QUALITY (quality_id,  accuracy_report, consistency_report,
       completeness_report, horizontal_acc_report, vertical_acc_report)
  select             quality_id,  accuracy_report, consistency_report,
       completeness_report, horizontal_acc_report, vertical_acc_report
  from LOAD_ENTRY;
--
-- ------------------------------------------------------------------------------------ entry:
insert into ENTRY (entry_id, entry_name, entry_acronym,            entry_type_id, summary_id, 
       quality_id, creation_date, review_date, future_review_date)
  select           entry_id, entry_name, entry_acronym, ENTRY_TYPE.entry_type_id, summary_id, 
       quality_id, creation_date, review_date, future_review_date 
  from load_entry, ENTRY_TYPE
 where LOAD_ENTRY.entry_type = ENTRY_TYPE.entry_type;
--
-- ---------------------------------------------------------------------------------- project:
insert into CAMPAIGN (entry_id,         project_id)
  select              entry_id, PROJECT.project_id
  from load_entry,project
 where load_entry.project_acronym = project.project_acronym;
--
-- --------------------------------------------------------------------------------- progress: 
update ENTRY E
   set progress_id = 
       (select PROGRESS.progress_id from LOAD_ENTRY,PROGRESS
         where E.entry_id=load_entry.entry_id
           and load_entry.progress_descr=PROGRESS.progress_descr)
 where E.entry_id in (select entry_id from load_entry);
