-- -------------------------------------------------------------
-- loadCHECKnew_id.sql:
-- This SQL script is to check the content of the loading layer
--   tables NEW_*: *_id field only.
--   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 
       22, 0, 'none', 'NEW_&1', 'FATNUL', '&1._id=NULL found: correct and run loadCHECK again!'
  from  NEW_&1    where &1._id is  NULL;
--
-- 2: no identical id allowed in NEW_*
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select distinct 
       23, 0, 'none', 'NEW_&1', 'FATDUB', 'There are '||count(&1._id)||' &1._id='||&1._id
  from  NEW_&1    group by &1._id    having count(&1._id)     >1;
--
-- 3: no identical id allowed in the original LOV
-- -------------------------------------------------------------
insert into LOAD_ERROR_MESSAGES select distinct 
       24, 0, 'none', 'NEW_&1' ,'FATDUB','&1._id='||&1._id||' found in table CERA.&1'
  from  NEW_&1    where &1._id IN (select  &1._id  from &1);
-- The END of loadCHECKnew_id.sql
