-- -------------------------------------------------------------
-- loadCHECKload_id.sql:
-- This SQL script is to check the content of the loading layer
--   here: only LOAD_ENTRY.entry_id
--   It is called from SQL script loadCHECK.sql.
--                                                ft, 1999.07.16
-- -------------------------------------------------------------
-- 1: no NULLS allowed in the _id column
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select distinct 
       3, -999, '...', 'LOAD_ENTRY', 'FATNUL', 'entry_id=NULL found: correct and run loadCHECK again!'
  from  LOAD_ENTRY where entry_id is NULL;
--
-- 2: no identical id allowed in LOAD_ENTRY
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select distinct 
       4, entry_id, max(LOAD_ENTRY.entry_acronym), 'LOAD_ENTRY', 'FATDUB', 'There are '||count(entry_id)||' entry_id='||entry_id
  from  LOAD_ENTRY group by entry_id having count(entry_id)     >1;
--
-- 3: no identical id allowed in the original LOV
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select distinct 
       5, entry_id, LOAD_ENTRY.entry_acronym, 'LOAD_ENTRY', 'FATDUB','entry_id='||entry_id||' found in table CERA.ENTRY'
  from  LOAD_ENTRY where entry_id IN (select entry_id  from ENTRY);
-- The END of loadCHECKnew_id.sql
